[issue4751] Patch for better thread support in hashlib

STINNER Victor report at bugs.python.org
Fri Jan 2 19:55:09 CET 2009


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

New implementation of finer lock grain in _hashlibopenssl: only create 
the lock at the first update with more than 8 KB bytes. Object 
creation/deallocation is faster if we hash less than 8 KB.

Changes between hashopenssl_threads-4.diff and my new patch: fix the 
deadlock in ENTER_HASHLIB() (for the GIL) without speed change 
(because we don't change the GIL state if we don't use a lock).

Changes between py3k trunk and my new patch:
 - release the GIL with large byte string => faster with multiple CPUs
 - fix EVP_get_block_size() and EVP_get_digest_size(): the context was 
not protected by the lock!

Added file: http://bugs.python.org/file12541/hashlibopenssl_small_lock.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4751>
_______________________________________


More information about the Python-bugs-list mailing list