This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients ebfe, gps, pitrou, vstinner
Date 2009-01-02.14:44:21
SpamBayes Score 6.5952327e-06
Marked as misclassified No
Message-id <1230907462.32.0.345917072702.issue4751@psf.upfronthosting.co.za>
In-reply-to
Content
> Releasing the GIL is somewhat expensive and should be avoided 
> if possible.

Another possible solution is to create a lockless object by default, 
and create a lock if the data size is bigger than N (eg. 8 KB). When 
the lock is created, update will always use the lock (and so the GIL).

In general, you have two classes of hashlib usages:
 - hash a big files by chunk of k KB (eg. 256 KB)
 - hash a very small string (eg. 8 bytes)

When you have a small string, you don't need to release the GIL nor to 
use locks. Whereas for a file, you can always release the GIL (and so 
you need a lock to protect the context).
History
Date User Action Args
2009-01-02 14:44:22vstinnersetrecipients: + vstinner, pitrou, gps, ebfe
2009-01-02 14:44:22vstinnersetmessageid: <1230907462.32.0.345917072702.issue4751@psf.upfronthosting.co.za>
2009-01-02 14:44:21vstinnerlinkissue4751 messages
2009-01-02 14:44:21vstinnercreate