STINNER Victor <victor.stin...@haypocalc.com> added the comment: > 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). Added file: http://bugs.python.org/file12462/md5sum.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue4751> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com