[Speed] Threading benchmark

Bhavishya bhavishyagopesh at gmail.com
Thu Aug 10 18:33:36 EDT 2017


Hello,

I as a part of my gsoc project(and on suggestion from my mentor )tried
writing a bencmark for threading module.
 It uses "perf" to measure crearion of objects like Thread,Semaphore,Locks
etc. and few methods on them but It might lack on experience and the
correctness of doing so.

Here's the bm
<https://gist.github.com/bhavishyagopesh/0790591474040575b5fa4470b9ea7b76> .

And here are the results of a run on my local machine [specs
<https://bhavishyagopesh.github.io/Second-Post/>]:


python3 bm_threading.py
.....................
basic: Mean +- std dev: 14.4 us +- 0.4 us
.....................
condition: Mean +- std dev: 18.1 ns +- 1.1 ns
.....................
lock: Mean +- std dev: 18.1 ns +- 0.9 ns
.....................
rlock: Mean +- std dev: 19.4 ns +- 1.6 ns
.....................
semaphore: Mean +- std dev: 298 ns +- 56 ns
.....................
timer: Mean +- std dev: 6.74 us +- 0.65 us



python2 bm_threading.py
.....................
basic: Mean +- std dev: 20.5 us +- 1.1 us
.....................
condition: Mean +- std dev: 148 ns +- 2 ns
.....................
lock: Mean +- std dev: 21.1 ns +- 0.7 ns
.....................
rlock: Mean +- std dev: 151 ns +- 3 ns
.....................
semaphore: Mean +- std dev: 336 ns +- 4 ns
.....................
timer: Mean +- std dev: 12.5 us +- 0.7 us

So suggestions?

Thank You
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/speed/attachments/20170811/773c4938/attachment.html>


More information about the Speed mailing list