cppyy: Automatic Python-C++ Bindings

76 pointsposted 3 days ago
by gjvc

7 Comments

rich_sasha

3 days ago

How very interesting. Only a few days ago I was reminiscing about scipy.weave, a horrendous hack and miracle of productivity in Python at the same time. It let users write inline C++, which would get compiled/cached into ephemeral extension modules. For certain jobs, and C++ users, beats numba, cython etc cleanly out of the water. It is sadly deprecated and long time not maintained. Is this a suitable replacement?

AFAICT this does not quite produce true binaries, but rather interprets C++ via Cling, is that right? And the docs only offer that C++-like speeds are achieved for PyPy. If there are any performance benchmarks for CPython3, I can't see find them. Thats the real question - few people combine Python and C++ just for the fun of it.

EDIT some benchmarks are available in this paper, linked from TFA: https://wlav.web.cern.ch/wlav/Cppyy_LavrijsenDutta_PyHPC16.p... But they don't really answer my question. The benchmarks seem to mostly look at the overhead of wrapping C++, rather than comparing to a Python implementation. There is some I/O involved in some of them, which is maybe not so interesting, and some of the benchmarks don't even have a pure CPython implementation. Where they do, speed is very close. But then the paper is from 2018, a lot may have changed.

wslh

2 days ago

If you like this, don't forget to take a look at SWIG [1] which supports a variety of programming language targets, including Python.

[1] https://www.swig.org/

actinium226

3 days ago

If I used cppyy in a project that I then made into a pip package, how would this affect distribution? It sounds like the end-user downloading the code would need a C++ compiler on their system, or does cppyy come with one?

bogeholm

3 days ago

The project name reminds me of the BBBQ where the B is for BYOBB

f1shy

2 days ago

Does somebody have experience how does this compares to LLM? I found it is a good use case for “AI programming” I had decent results.