homepage

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 kristjan.jonsson
Recipients brian.curtin, kristjan.jonsson, loewis, pitrou, python-dev, sbt, tim.golden
Date 2012年04月20日.14:58:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1334933939.01.0.564427901646.issue11618@psf.upfronthosting.co.za>
In-reply-to
Content
Two runs with standard locks:
D:\pydev\hg\cpython2>pcbuild\amd64\python.exe -m timeit -s "import _thread; l = _thread.allocate_lock()" l.acquire();l.release()
1000000 loops, best of 3: 0.746 usec per loop
D:\pydev\hg\cpython2>pcbuild\amd64\python.exe -m timeit -s "import _thread; l = _thread.allocate_lock()" l.acquire();l.release()
1000000 loops, best of 3: 0.749 usec per loop
Two runs with CV locks (emulated)
D:\pydev\hg\cpython2>pcbuild\amd64\python.exe -m timeit -s "import _thread; l = _thread.allocate_lock()" l.acquire();l.release()
1000000 loops, best of 3: 0.278 usec per loop
D:\pydev\hg\cpython2>pcbuild\amd64\python.exe -m timeit -s "import _thread; l = _thread.allocate_lock()" l.acquire();l.release()
1000000 loops, best of 3: 0.279 usec per loop
Two runs with CV locks targeted for Vista:
D:\pydev\hg\cpython2>pcbuild\amd64\python.exe -m timeit -s "import _thread; l = _thread.allocate_lock()" l.acquire();l.release()
1000000 loops, best of 3: 0.272 usec per loop
D:\pydev\hg\cpython2>pcbuild\amd64\python.exe -m timeit -s "import _thread; l = _thread.allocate_lock()" l.acquire();l.release()
1000000 loops, best of 3: 0.272 usec per loop
You can see the big win from not doing kernel switches all the time. shedding 60% of the time.
Once in user space, moving from CriticalSection objects to SRWLock objects is less beneficial, being overshadowed by Python overhead. Still, 2% overall is not to be frowned upon.
History
Date User Action Args
2012年04月20日 14:58:59kristjan.jonssonsetrecipients: + kristjan.jonsson, loewis, pitrou, tim.golden, brian.curtin, python-dev, sbt
2012年04月20日 14:58:59kristjan.jonssonsetmessageid: <1334933939.01.0.564427901646.issue11618@psf.upfronthosting.co.za>
2012年04月20日 14:58:58kristjan.jonssonlinkissue11618 messages
2012年04月20日 14:58:58kristjan.jonssoncreate

AltStyle によって変換されたページ (->オリジナル) /