We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Call a C API from Python becomes more enjoyable with CFFI

Formale Metadaten

Titel
Call a C API from Python becomes more enjoyable with CFFI
Serientitel
Anzahl der Teile
160
Autor
Lizenz
CC-Namensnennung - keine kommerzielle Nutzung - Weitergabe unter gleichen Bedingungen 3.0 Unported:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen und nicht-kommerziellen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen und das Werk bzw. diesen Inhalt auch in veränderter Form nur unter den Bedingungen dieser Lizenz weitergeben
Identifikatoren
Herausgeber
Erscheinungsjahr
Sprache

Inhaltliche Metadaten

Fachgebiet
Genre
Abstract
Call a C API from Python becomes more enjoyable with CFFI [EuroPython 2017 - Talk - 2017-07-12 - Anfiteatro 2] [Rimini, Italy] Python is slow ! Python can’t access bare metal! You often hear theses assumptions? Theses limitations can be surpassed by Python extensions written in C. However, according to my personal experience, doing this by leveraging C may yield to several issues (e.g., memory management). C Foreign Function Interface for Python (a.k.a., CFFI) allows you to easily write Python extensions. One of the main aims of CFFI is to to wrap C libraries. Along the same lines, it may also be used for performance enhancement. By this call, I am firstly presenting CFFI and it’s two modes of utilization: API level and ABI level. Then I will share my own experience about wrapping shaderc library (https://github.com/google/shaderc) in six hours pyshaderc (https://github.com/realitix/pyshaderc). Next we are going to the next level, let’s wrap all the Vulkan API! Vulkan is the new 3D API and is not a piece of cake. To see the real advantage of CFFI, a side by side comparison between two Python modules is going to be presented: CVulkan is a Vulkan wrapper written fully in C, it’s a classic C extension for Python vulkan is its CFFI counterpart without any C written, only Python I have developed two versions of Vulkan wrapper (one in a pure C, and the second by leveraging CFFI) and I can assure you that CFFI is a a way better! Let’s code