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 jcea
Recipients jcea
Date 2008-05-29.15:28:06
SpamBayes Score 0.03363898
Marked as misclassified No
Message-id <1212074891.45.0.23606216758.issue3001@psf.upfronthosting.co.za>
In-reply-to
Content
threading.RLock acquire/release is very slow. A order of magnitude
higher than no reentrant threading.Lock:

"""
def RLockSpeed() :
  import time, threading
  t=time.time()
  result={}
  for i in xrange(1000000) :
    pass
  result["empty loop"]=time.time()-t
  l=threading.Lock()
  t=time.time()
  for i in xrange(1000000) :
    l.acquire()
    l.release()
  result["Lock"]=time.time()-t
  l=threading.RLock()
  t=time.time()
  for i in xrange(1000000) :
    l.acquire()
    l.release()
  result["RLock"]=time.time()-t
  return result

if __name__=="__main__" :
  print RLockSpeed()
"""

Result:
{'empty loop': 0.074212074279785156, 'RLock': 10.144084215164185,
'Lock': 1.2489800453186035}
History
Date User Action Args
2008-05-29 15:28:12jceasetspambayes_score: 0.033639 -> 0.03363898
recipients: + jcea
2008-05-29 15:28:11jceasetspambayes_score: 0.033639 -> 0.033639
messageid: <1212074891.45.0.23606216758.issue3001@psf.upfronthosting.co.za>
2008-05-29 15:28:09jcealinkissue3001 messages
2008-05-29 15:28:07jceacreate