3 ms·
I have done some benchmark recently of Python 3.11, and pure Python code was even beating a Python-wrapped C++ implementation of the same data structure. While
by bonzini 4y ago
I have done some benchmark recently of Python 3.11, and pure Python code was even beating a Python-wrapped C++ implementation of the same data structure. While it's not an entirely apples-to-apples comparison (the reason to use C++ was to enable running without the global interpreter lock), it is still very impressive.
- noloblo 4y agoDo you mind sharing Which python wrapped cpp implementation you might have done the benchmark comparison on ?
- mkoubaa 4y agoPython wrapping using binding tools like swig or cython or boost python are bound to be slower for things like data structures. They bring with them a lot of overhead between the python interpreter and the call into the data structure
- bonzini 4y agoIt's at https://github.com/bonzini/vrc https://github.com/bonzini/vrc. The wrapper is Cython-based.
- pjmlp 4y agoIn the early Android days, Dalvik did quite a poor job generating native code, so many math functions went through JNI into native code. Eventually Dalvik got replaced with ART, Android team started to care about JITing and AOT compilation, and all those native methods got deprecated as JIT/AOT code out of pure Java implementation started to be faster than the cost to jump through FFI infrastructure.