[issue13451] sched.py: speedup cancel() method

Serhiy Storchaka report at bugs.python.org
Tue Oct 15 23:37:46 CEST 2013


Serhiy Storchaka added the comment:

> it wasn't clear to me *where* exactly the enter() speedup was introduced

Constructing Event object. You introduced __init__().

Here is a patch which is based on my patch and new Giampaolo's patch. In additional it fixes a performance for the queue property (perhaps regression was introduced in issue18432).

Unpatched:

test_cancel                    : time=4.05863 : calls=1 : stdev=0.00000
test_empty                     : time=0.00499 : calls=1 : stdev=0.00000
test_enter                     : time=0.03537 : calls=1 : stdev=0.00000
test_queue                     : time=37.82003 : calls=1 : stdev=0.00000
test_run                       : time=0.05289 : calls=1 : stdev=0.00000

cancel3.patch:

test_cancel                    : time=0.00649 : calls=1 : stdev=0.00000
test_empty                     : time=0.00704 : calls=1 : stdev=0.00000
test_enter                     : time=0.03959 : calls=1 : stdev=0.00000
test_queue                     : time=45.34278 : calls=1 : stdev=0.00000
test_run                       : time=0.05477 : calls=1 : stdev=0.00000

cancel_4.patch:

test_cancel                    : time=0.00889 : calls=1 : stdev=0.00000
test_empty                     : time=0.00636 : calls=1 : stdev=0.00000
test_enter                     : time=0.03092 : calls=1 : stdev=0.00000
test_queue                     : time=3.93284 : calls=1 : stdev=0.00000
test_run                       : time=0.05294 : calls=1 : stdev=0.00000

----------
Added file: http://bugs.python.org/file32138/cancel_4.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13451>
_______________________________________


More information about the Python-bugs-list mailing list