SimpleArray between Python and C++ - Yung-Yu Chen
歡迎來到 PyCon TW 2023 共筆
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
共筆入口:https://hackmd.io/@pycontw/2023
手機版請點選上方 按鈕展開議程列表。
Welcome to PyCon TW 2023 Collaborative Writing
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Collaborative Writing Workplace:https://hackmd.io/@pycontw/2023
Using mobile please tap to unfold the agenda.
Collaborative writing start from below
從這裡開始共筆
hand-cragt arry
Make your own array
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.