From bhavishyagopesh at gmail.com Thu Aug 10 18:33:36 2017 From: bhavishyagopesh at gmail.com (Bhavishya) Date: Fri, 11 Aug 2017 04:03:36 +0530 Subject: [Speed] Threading benchmark Message-ID: 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 . And here are the results of a run on my local machine [specs ]: 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: From victor.stinner at gmail.com Thu Aug 10 18:39:29 2017 From: victor.stinner at gmail.com (Victor Stinner) Date: Fri, 11 Aug 2017 00:39:29 +0200 Subject: [Speed] Threading benchmark In-Reply-To: References: Message-ID: I don't understand what you are trying to test. For example, for a lock, it's very different if a single thread uses the lock, or if two threads use the lock. None of your benchmarks seem to measure concurrency. Victor 2017-08-11 0:33 GMT+02:00 Bhavishya : > 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 . > > And here are the results of a run on my local machine [specs]: > > > 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 > > _______________________________________________ > Speed mailing list > Speed at python.org > https://mail.python.org/mailman/listinfo/speed > From bhavishyagopesh at gmail.com Fri Aug 11 19:32:07 2017 From: bhavishyagopesh at gmail.com (Bhavishya) Date: Sat, 12 Aug 2017 05:02:07 +0530 Subject: [Speed] Threading benchmark In-Reply-To: References: Message-ID: Sorry but I realised that the actual bottleneck is with "range" (and enumeration is slower in py3.) https://stackoverflow.com/questions/23453133/is-there-a-reason-python-3-enumerates-slower-than-python-2.So it's not fair to say that multiprocessing is slow... On Sat, Aug 12, 2017 at 4:37 AM, Bhavishya wrote: > Hello, > > WHY-> Presently there are no benchmarks for concurrency, > > METHOD USED-> This s > cript > tries to benchmark "Concurrency" implemented using threading and > multiprocessing module.Actually "threads" in cpython are restricted by > "GIL",so it's not actually concurrent...On the other hand "multiprocessing" > module creates whole different processes but there is substaintial cost > involved in spawing a whole new process. > So the there is a trade-off involved which is evident as we increase > "CRUNCH_NO" variable. > > ToNote-> Interestingly Here py2 looks faster.(actually by a considerable > margin) > I'm attaching graphs that compare py2 and py3. > > IMPROVEMENTS-> More use cases(apart from number crunching)which could > verify this and reproduce similar thing. > > SO Suggestions required? > > thank you. > > > On Fri, Aug 11, 2017 at 4:09 AM, Victor Stinner > wrote: > >> I don't understand what you are trying to test. For example, for a >> lock, it's very different if a single thread uses the lock, or if two >> threads use the lock. None of your benchmarks seem to measure >> concurrency. >> >> Victor >> >> 2017-08-11 0:33 GMT+02:00 Bhavishya : >> > 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 . >> > >> > And here are the results of a run on my local machine [specs]: >> > >> > >> > 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 >> > >> > _______________________________________________ >> > Speed mailing list >> > Speed at python.org >> > https://mail.python.org/mailman/listinfo/speed >> > >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bhavishyagopesh at gmail.com Fri Aug 11 20:40:00 2017 From: bhavishyagopesh at gmail.com (Bhavishya) Date: Sat, 12 Aug 2017 06:10:00 +0530 Subject: [Speed] Threading benchmark In-Reply-To: References: Message-ID: I just ran a bm that does this number_crunching task(serially), and results are-> py2: number_crunching: Mean +- std dev: 35.9 ms +- 1.0 ms py3: number_crunching: Mean +- std dev: 64.1 ms +- 4.1 ms And after turning *x to Long *in py2: number_crunching: Mean +- std dev: 168 ms +- 11 ms So what're your thoughts? thank you On Sat, Aug 12, 2017 at 5:02 AM, Bhavishya wrote: > Sorry but I realised that the actual bottleneck is with "range" (and > enumeration is slower in py3.) https://stackoverflow.com/ > questions/23453133/is-there-a-reason-python-3-enumerates- > slower-than-python-2.So it's not fair to say that multiprocessing is > slow... > > > On Sat, Aug 12, 2017 at 4:37 AM, Bhavishya > wrote: > >> Hello, >> >> WHY-> Presently there are no benchmarks for concurrency, >> >> METHOD USED-> This s >> cript >> tries to benchmark "Concurrency" implemented using threading and >> multiprocessing module.Actually "threads" in cpython are restricted by >> "GIL",so it's not actually concurrent...On the other hand "multiprocessing" >> module creates whole different processes but there is substaintial cost >> involved in spawing a whole new process. >> So the there is a trade-off involved which is evident as we increase >> "CRUNCH_NO" variable. >> >> ToNote-> Interestingly Here py2 looks faster.(actually by a considerable >> margin) >> I'm attaching graphs that compare py2 and py3. >> >> IMPROVEMENTS-> More use cases(apart from number crunching)which could >> verify this and reproduce similar thing. >> >> SO Suggestions required? >> >> thank you. >> >> >> On Fri, Aug 11, 2017 at 4:09 AM, Victor Stinner > > wrote: >> >>> I don't understand what you are trying to test. For example, for a >>> lock, it's very different if a single thread uses the lock, or if two >>> threads use the lock. None of your benchmarks seem to measure >>> concurrency. >>> >>> Victor >>> >>> 2017-08-11 0:33 GMT+02:00 Bhavishya : >>> > 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 . >>> > >>> > And here are the results of a run on my local machine [specs]: >>> > >>> > >>> > 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 >>> > >>> > _______________________________________________ >>> > Speed mailing list >>> > Speed at python.org >>> > https://mail.python.org/mailman/listinfo/speed >>> > >>> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From solipsis at pitrou.net Sat Aug 12 04:44:22 2017 From: solipsis at pitrou.net (Antoine Pitrou) Date: Sat, 12 Aug 2017 10:44:22 +0200 Subject: [Speed] Threading benchmark References: Message-ID: <20170812104422.0e2ab739@fsol> On Sat, 12 Aug 2017 06:10:00 +0530 Bhavishya wrote: > I just ran a bm > > that does this number_crunching task(serially), and results are-> > [...] > > So what're your thoughts? Before looking at benchmarks it would be nice to know what you are trying to investigate. What is your GSoC topic and who is your mentor? Regards Antoine. From bhavishyagopesh at gmail.com Sun Aug 13 01:00:34 2017 From: bhavishyagopesh at gmail.com (Bhavishya) Date: Sun, 13 Aug 2017 10:30:34 +0530 Subject: [Speed] Speed Digest, Vol 38, Issue 2 In-Reply-To: References: Message-ID: Hello, So I'm trying to find areas where py3 falls behind py2 in terms of performance.Augment reasons and if possible, solutions. And my mentor(@Botanic) suggested if we could write benchmarks for some modules which presently lack explicit bms and thus we tried writing bm for "threading" module and another to compare concurrency implemented using "threading"(which is actually restricted by gil) and using "multiprocessing" across py2 & py3 Thank you On Aug 12, 2017 2:14 PM, wrote: > Send Speed mailing list submissions to > speed at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/speed > or, via email, send a message with subject or body 'help' to > speed-request at python.org > > You can reach the person managing the list at > speed-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Speed digest..." > > > Today's Topics: > > 1. Re: Threading benchmark (Bhavishya) > 2. Re: Threading benchmark (Bhavishya) > 3. Re: Threading benchmark (Antoine Pitrou) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sat, 12 Aug 2017 05:02:07 +0530 > From: Bhavishya > To: Victor Stinner > Cc: speed at python.org > Subject: Re: [Speed] Threading benchmark > Message-ID: > gmail.com> > Content-Type: text/plain; charset="utf-8" > > Sorry but I realised that the actual bottleneck is with "range" (and > enumeration is slower in py3.) > https://stackoverflow.com/questions/23453133/is-there-a- > reason-python-3-enumerates-slower-than-python-2.So > it's not fair to say that multiprocessing is slow... > > > On Sat, Aug 12, 2017 at 4:37 AM, Bhavishya > wrote: > > > Hello, > > > > WHY-> Presently there are no benchmarks for concurrency, > > > > METHOD USED-> This s > > 9a>cript > > tries to benchmark "Concurrency" implemented using threading and > > multiprocessing module.Actually "threads" in cpython are restricted by > > "GIL",so it's not actually concurrent...On the other hand > "multiprocessing" > > module creates whole different processes but there is substaintial cost > > involved in spawing a whole new process. > > So the there is a trade-off involved which is evident as we increase > > "CRUNCH_NO" variable. > > > > ToNote-> Interestingly Here py2 looks faster.(actually by a considerable > > margin) > > I'm attaching graphs that compare py2 and py3. > > > > IMPROVEMENTS-> More use cases(apart from number crunching)which could > > verify this and reproduce similar thing. > > > > SO Suggestions required? > > > > thank you. > > > > > > On Fri, Aug 11, 2017 at 4:09 AM, Victor Stinner < > victor.stinner at gmail.com> > > wrote: > > > >> I don't understand what you are trying to test. For example, for a > >> lock, it's very different if a single thread uses the lock, or if two > >> threads use the lock. None of your benchmarks seem to measure > >> concurrency. > >> > >> Victor > >> > >> 2017-08-11 0:33 GMT+02:00 Bhavishya : > >> > 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 . > >> > > >> > And here are the results of a run on my local machine [specs]: > >> > > >> > > >> > 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 > >> > > >> > _______________________________________________ > >> > Speed mailing list > >> > Speed at python.org > >> > https://mail.python.org/mailman/listinfo/speed > >> > > >> > > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: 20170812/9dc16c3a/attachment-0001.html> > > ------------------------------ > > Message: 2 > Date: Sat, 12 Aug 2017 06:10:00 +0530 > From: Bhavishya > To: Victor Stinner > Cc: speed at python.org > Subject: Re: [Speed] Threading benchmark > Message-ID: > zpShiqRGnw1exA at mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > I just ran a bm > > that does this number_crunching task(serially), and results are-> > > py2: > number_crunching: Mean +- std dev: 35.9 ms +- 1.0 ms > > py3: > number_crunching: Mean +- std dev: 64.1 ms +- 4.1 ms > > And after turning *x to Long *in py2: > number_crunching: Mean +- std dev: 168 ms +- 11 ms > > So what're your thoughts? > > thank you > > > On Sat, Aug 12, 2017 at 5:02 AM, Bhavishya > wrote: > > > Sorry but I realised that the actual bottleneck is with "range" (and > > enumeration is slower in py3.) https://stackoverflow.com/ > > questions/23453133/is-there-a-reason-python-3-enumerates- > > slower-than-python-2.So it's not fair to say that multiprocessing is > > slow... > > > > > > On Sat, Aug 12, 2017 at 4:37 AM, Bhavishya > > wrote: > > > >> Hello, > >> > >> WHY-> Presently there are no benchmarks for concurrency, > >> > >> METHOD USED-> This s > >> 9a>cript > >> tries to benchmark "Concurrency" implemented using threading and > >> multiprocessing module.Actually "threads" in cpython are restricted by > >> "GIL",so it's not actually concurrent...On the other hand > "multiprocessing" > >> module creates whole different processes but there is substaintial cost > >> involved in spawing a whole new process. > >> So the there is a trade-off involved which is evident as we increase > >> "CRUNCH_NO" variable. > >> > >> ToNote-> Interestingly Here py2 looks faster.(actually by a considerable > >> margin) > >> I'm attaching graphs that compare py2 and py3. > >> > >> IMPROVEMENTS-> More use cases(apart from number crunching)which could > >> verify this and reproduce similar thing. > >> > >> SO Suggestions required? > >> > >> thank you. > >> > >> > >> On Fri, Aug 11, 2017 at 4:09 AM, Victor Stinner < > victor.stinner at gmail.com > >> > wrote: > >> > >>> I don't understand what you are trying to test. For example, for a > >>> lock, it's very different if a single thread uses the lock, or if two > >>> threads use the lock. None of your benchmarks seem to measure > >>> concurrency. > >>> > >>> Victor > >>> > >>> 2017-08-11 0:33 GMT+02:00 Bhavishya : > >>> > 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 . > >>> > > >>> > And here are the results of a run on my local machine [specs]: > >>> > > >>> > > >>> > 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 > >>> > > >>> > _______________________________________________ > >>> > Speed mailing list > >>> > Speed at python.org > >>> > https://mail.python.org/mailman/listinfo/speed > >>> > > >>> > >> > >> > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: 20170812/f05a2619/attachment-0001.html> > > ------------------------------ > > Message: 3 > Date: Sat, 12 Aug 2017 10:44:22 +0200 > From: Antoine Pitrou > To: speed at python.org > Subject: Re: [Speed] Threading benchmark > Message-ID: <20170812104422.0e2ab739 at fsol> > Content-Type: text/plain; charset=US-ASCII > > On Sat, 12 Aug 2017 06:10:00 +0530 > Bhavishya > wrote: > > I just ran a bm > > e4> > > that does this number_crunching task(serially), and results are-> > > > [...] > > > > So what're your thoughts? > > Before looking at benchmarks it would be nice to know what you are > trying to investigate. What is your GSoC topic and who is your mentor? > > Regards > > Antoine. > > > > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > Speed mailing list > Speed at python.org > https://mail.python.org/mailman/listinfo/speed > > > ------------------------------ > > End of Speed Digest, Vol 38, Issue 2 > ************************************ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bhavishyagopesh at gmail.com Fri Aug 11 19:07:52 2017 From: bhavishyagopesh at gmail.com (Bhavishya) Date: Sat, 12 Aug 2017 04:37:52 +0530 Subject: [Speed] Threading benchmark In-Reply-To: References: Message-ID: Hello, WHY-> Presently there are no benchmarks for concurrency, METHOD USED-> This s cript tries to benchmark "Concurrency" implemented using threading and multiprocessing module.Actually "threads" in cpython are restricted by "GIL",so it's not actually concurrent...On the other hand "multiprocessing" module creates whole different processes but there is substaintial cost involved in spawing a whole new process. So the there is a trade-off involved which is evident as we increase "CRUNCH_NO" variable. ToNote-> Interestingly Here py2 looks faster.(actually by a considerable margin) I'm attaching graphs that compare py2 and py3. IMPROVEMENTS-> More use cases(apart from number crunching)which could verify this and reproduce similar thing. SO Suggestions required? thank you. On Fri, Aug 11, 2017 at 4:09 AM, Victor Stinner wrote: > I don't understand what you are trying to test. For example, for a > lock, it's very different if a single thread uses the lock, or if two > threads use the lock. None of your benchmarks seem to measure > concurrency. > > Victor > > 2017-08-11 0:33 GMT+02:00 Bhavishya : > > 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 . > > > > And here are the results of a run on my local machine [specs]: > > > > > > 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 > > > > _______________________________________________ > > Speed mailing list > > Speed at python.org > > https://mail.python.org/mailman/listinfo/speed > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: py2.pdf Type: application/pdf Size: 54089 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: py3.pdf Type: application/pdf Size: 57712 bytes Desc: not available URL: From solipsis at pitrou.net Tue Aug 15 19:33:32 2017 From: solipsis at pitrou.net (Antoine Pitrou) Date: Wed, 16 Aug 2017 01:33:32 +0200 Subject: [Speed] Speed Digest, Vol 38, Issue 2 References: Message-ID: <20170816013332.59fcc4dc@fsol> On Sun, 13 Aug 2017 10:30:34 +0530 Bhavishya wrote: > Hello, > So I'm trying to find areas where py3 falls behind py2 in terms of > performance.Augment reasons and if possible, solutions. > > And my mentor(@Botanic) suggested if we could write benchmarks for some > modules which presently lack explicit bms and thus we tried writing bm for > "threading" module and another to compare concurrency implemented using > "threading"(which is actually restricted by gil) and using > "multiprocessing" across py2 & py3 I'm uncertain that this is a good approach. Measuring the performance of a single module doesn't necessary tell us anything about the performance of real-world applications. You first have to assess whethow the performance of said module impacts real-world applications. This probably requires some domain-specific knowledge, which either you have or would have to inquire about. Regards Antoine.