threading.py -> winthreading.c : Call for benchmark code

Jason Orendorff jason at jorendorff.com
Thu Dec 20 04:49:20 EST 2001


Everyone,

I am reimplementing parts of threading.py in non-portable
Win32-only C.  Lock and RLock are already working.  Tests show:
  winthreading.Lock is about 25% faster than threading.Lock.
  winthreading.RLock is about 26 times as fast as threading.Lock!

But I'm not sure these numbers translate into real-world gains.
So: I'm looking for Python code that shows how these objects
(Lock, RLock, Condition, Semaphore, Event) are used in the wild.

If you're interested in a 26x faster RLock, please send me
real-world Python code that could benefit.

Thanks in advance,
Jason Orendorff

[Technical note:  I discovered something neat.  Everything I do,
or check, or set, or increment in C code is protected by the global
interpreter lock.  This eliminates a lot of the complexity of writing
good threading code, because I don't have to worry about doing
anything atomically!  I can avoid functions like InterlockedIncrement()
and InterlockedExchange().  The resulting code is clearer and faster.]






More information about the Python-list mailing list