> I've taken on haypo's patch to release the GIL only
> when the buffer is larger than 10kb
You can factorize the code by moving Py_BEGIN_ALLOW_THREADS /
Py_END_ALLOW_THREADS *into* EVP_hash ;-)
10 KB is a random value or the fast value for your computer?
I wrote a small benchmark: md5sum.py, my Python multithreaded version
of md5sum. Results on 129 files (between 7 and 10 MB) on an Intel Quad
Core @ 2.5 GHz:
- without the patch: best=10.6 sec / average ~= 11.5 sec
- with the patch (version 3): best=7.7 sec / average ~= 8.5 sec
My program creates N threads for N files, which is maybe stupid (eg.
limit to C+1 thread for C cores). |