@@ -71,7 +71,7 @@ timings instead of 100000x for the single threaded case.
7171
7272::
7373
74- Testing threading.RLock
74+ Testing threading.RLock (2.7)
7575
7676 sequential (x100000):
7777 lock_unlock : 1.408 sec
@@ -100,39 +100,45 @@ timings instead of 100000x for the single threaded case.
100100 lock_unlock_nonblocking : 0.916 sec
101101
102102
103- How does it compare to Python 3.2 and later?
103+ How does it compare to Python 3.7 and later?
104104--------------------------------------------
105105
106- Here is the same benchmark run with Py3.2::
106+ The results here are more mixed. Depending on the optimisation of the CPython
107+ installation, it can be faster, about the same speed, or somewhat slower.
108+ In any case, the direct Cython interface is always faster than going through
109+ the Python API, because it avoids the Python call overhead and executes
110+ a C call instead.
107111
108- Testing threading.RLock
109-
110- sequential (x100000):
111- lock_unlock : 0.134 sec
112- reentrant_lock_unlock : 0.120 sec
113- mixed_lock_unlock : 0.151 sec
114- lock_unlock_nonblocking : 0.177 sec
115-
116- threaded 10T (x1000):
117- lock_unlock : 0.885 sec
118- reentrant_lock_unlock : 0.972 sec
119- mixed_lock_unlock : 0.883 sec
120- lock_unlock_nonblocking : 0.911 sec
121-
122- Testing FastRLock
123-
124- sequential (x100000):
125- lock_unlock : 0.093 sec
126- reentrant_lock_unlock : 0.093 sec
127- mixed_lock_unlock : 0.104 sec
128- lock_unlock_nonblocking : 0.112 sec
112+ ::
129113
130- threaded 10T (x1000):
131- lock_unlock : 0.943 sec
132- reentrant_lock_unlock : 0.871 sec
133- mixed_lock_unlock : 0.920 sec
134- lock_unlock_nonblocking : 0.908 sec
135-
136- So, in the single-threaded case, the C implementation in Py3.2 is only
137- about 20-50% slower than the Cython implementation here, whereas it is
138- more or less as fast in the congested case.
114+ Testing threading.RLock (3.9.7)
115+
116+ sequential (x1000):
117+ lock_unlock : 1.00 msec
118+ reentrant_lock_unlock : 0.80 msec
119+ mixed_lock_unlock : 0.88 msec
120+ lock_unlock_nonblocking : 1.23 msec
121+ context_manager : 5.29 msec
122+
123+ threaded 10T (x100):
124+ lock_unlock : 65.54 msec
125+ reentrant_lock_unlock : 65.49 msec
126+ mixed_lock_unlock : 86.61 msec
127+ lock_unlock_nonblocking : 66.30 msec
128+ context_manager : 84.27 msec
129+
130+ Testing FastRLock (0.8)
131+
132+ sequential (x1000):
133+ lock_unlock : 0.60 msec
134+ reentrant_lock_unlock : 0.53 msec
135+ mixed_lock_unlock : 0.51 msec
136+ lock_unlock_nonblocking : 0.54 msec
137+ context_manager : 3.56 msec
138+
139+ threaded 10T (x100):
140+ lock_unlock : 63.64 msec
141+ reentrant_lock_unlock : 69.93 msec
142+ mixed_lock_unlock : 64.66 msec
143+ lock_unlock_nonblocking : 69.28 msec
144+ context_manager : 80.07 msec
0 commit comments