---
title: "SimpleArray between Python and C++ - Yung-Yu Chen"
tags: PyConTW2023, 2023-organize, 2023-共筆
---
# SimpleArray between Python and C++ - Yung-Yu Chen
{%hackmd H6-2BguNT8iE7ZUrnoG1Tg %}
<iframe src=https://app.sli.do/event/jqbgusEtCBmAArhMqN8dpK height=450 width=100%></iframe>
> Collaborative writing start from below
> 從這裡開始共筆
# hand-cragt arry
- 處理多維資料
# Make your own array
- Key: Buffer Management,
# Multi-dimensional array
• SimpleArray is a class template
• Holds a contiguous memory buffer
• Provides multi-dimensional accessors to its elements
• Designed for fundamental types; might be used for POD types (untested)
# Buffer Management
https://github.com/pybind/pybind11
Below is the part that speaker updated the talk/tutorial after speech
講者於演講後有更新或勘誤投影片的部份
Response to unanswered questions:
* What the main difference between C++ exposed to python and python calling c++
* The former allows fully-customizable resource management, while the latter relies on Python interpreter. For large, mission-critical system, it is not practical to rely on Python for managing the resource and needs to go with the former.
* What does Python bring to the table so you have to stick with it even if the speed is so slowwww? (edited)
* Numpy sometimes helps to speed up if the problems can be cast to the array batch form. Otherwise, Cython and/or numba may help to speed up slightly more cases.
* Have you ever written a Python package using assembly language?
* No. While it is not impossible, it is less maintainable and more painful than doing it in C++ and wrapping it to Python.
* will mojo be a game changer if you want to have the readability python provides and the performance of C++?
* For speed, mojo may be a contender to the Python and C/C++ hybrid architecture. But for mission-critical applications, C++ is still the way to go. No new language systems are providing a convincing alternative.