Why should you learn writing C extension?

Abstract

- Are you sometimes frustrated by the performance of Python?

- Do you always look for open source library to speed up your process?
- Do you feel numpy cannot give you much edge to enhance the performance now?

If you answer yes in any of the above questions, probably writing C extension will be a great solution to you.

First we will go through the reasons to learn writing C extension. Then the modern libraries, e.g. Cython and pybind11, will be introduced to develop C extension and compared with their features and functionalities. Also, a few simple but practical examples are demonstrated that writing C extension can be straightforward, and improves greatly your software quality and performance.

Description

[Extending Python with C / C++](https://docs.python.org/3/extending/extending.html) is a complicated section in Python even for experienced Python developers. It is supported by binding the interfaces between Python and C objects with CPython API. The whole flow involves linking / compilation of the source codes during installation, the convention between C and Python object, and memory management in reference count. Developers mostly feel writing C extension requires a great amount of development time, effort and knowledge. Also the cost to maintain a good piece of software with C extension is enormous. In the talk, I would like to give out the solutions to these myths by introducing modern approaches on writing C extension. Also I will try to convince the audience that, with the appropriate tools, migrating the pure Python code to C extension code in the performance critical components can be a great investment in the application.

Speaker

Gavin Chan

Gavin Chan is a principal quantitative developer in AXA Investment Managers Chorus Ltd with 7+ years of experience in software development and finance industry.