from Python in C, because that function is really slow from being executed in Python.
Supposed a shared library compiled in C, has a extern function which’s a heavy CPU-bounded computing operation.
That function was called from Python with ctype exposed from shared library .
My question is how native function was executed by cpython internally.
It’s handled by interpreter?
This also happen in C#, Java or other VM-based language, if a native function call from them, can I get native performance benefits?
nope
Write an extension.
yes, it's very common, it's used to do IO or threads, or similar things, so the main thread (of interpreter) is not stopped for that
Обсуждают сегодня