Author sserrano
Recipients Rhamphoryncus, giampaolo.rodola, jcea, pitrou, sserrano
Date 2008-06-21.16:40:49
SpamBayes Score 0.0128689
Marked as misclassified No
Message-id <1214066453.72.0.628330871591.issue3001@psf.upfronthosting.co.za>
In-reply-to
Content
Running with python -O the timing gets a little closer between Lock and
RLock. This code won't be easy to improve in performance. 
The heaviest call is current_thread(), used at lines:
117:    me = current_thread()
137:    if self.__owner is not current_thread():

and only consist on:
788: def current_thread():
789:     try:
790:         return _active[_get_ident()]
791:     except KeyError:
792:         ##print "current_thread(): no current thread for", _get_ident()
793:         return _DummyThread()

Simple profiler dump:
$../python-trunk/python -O rlock.py 
time Lock 0.720541000366
time RLock 4.90231084824
         400004 function calls in 0.982 CPU seconds

   Ordered by: internal time, call count

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   100000    0.304    0.000    0.390    0.000 threading.py:116(acquire)
   100000    0.278    0.000    0.360    0.000 threading.py:136(release)
        1    0.232    0.232    0.982    0.982 rlock.py:27(testRLock)
   200000    0.168    0.000    0.168    0.000
threading.py:788(current_thread)
        1    0.000    0.000    0.000    0.000 threading.py:103(__init__)
        1    0.000    0.000    0.000    0.000 threading.py:98(RLock)
        1    0.000    0.000    0.000    0.000 threading.py:76(__init__)
        0    0.000             0.000          profile:0(profiler)
History
Date User Action Args
2008-06-21 16:40:54sserranosetspambayes_score: 0.0128689 -> 0.0128689
recipients: + sserrano, jcea, Rhamphoryncus, pitrou, giampaolo.rodola
2008-06-21 16:40:53sserranosetspambayes_score: 0.0128689 -> 0.0128689
messageid: <1214066453.72.0.628330871591.issue3001@psf.upfronthosting.co.za>
2008-06-21 16:40:52sserranolinkissue3001 messages
2008-06-21 16:40:49sserranocreate