Calling python from C with OpenMP

Paul Rubin no.email at nospam.invalid
Fri May 13 22:09:48 EDT 2016


Dennis Lee Bieber <wlfraed at ix.netcom.com> writes:
> 	It's been tried -- but the non-GIL implementations tend to be
> slower at everything else.

Has Micropython been compared?  CPython needs the GIL because of its
frequent twiddling of reference counts.  Without the GIL, multi-threaded
CPython would have to acquire and release a lock whenever it touched a
refcount, which slows things down badly.

MicroPython uses a tracing garbage collector instead of refcounts, so
there's no issue of having to lock refcounts all the time.  It's fairly
common in such systems to stop all the user threads during GC, but they
can happily run in parallel the rest of the time.  

Come to think of it, I don't know if MicroPython currently supports
threads at all!  But its implementation style (i.e. no refcounts) is
more parallelism-friendly than CPython's.



More information about the Python-list mailing list