Message290781
Thank you for testing Louie. Thank you for your review and testing Xiang.
> Would it completely kill performances to remove the optimization?
Yes. The optimization is not used if the lowest byte is 0. You can try to search "\0" for getting the result without the optimization. On my netbook the optimization speeds up searching by 5.5 times.
Search with optimization:
$ ./python -m perf timeit -s 's = "АБВГД"*10**5' -- 's.find("Ж")'
Median +- std dev: 296 us +- 33 us
Search without optimization:
$ ./python -m perf timeit -s 's = "АБВГД"*10**5' -- 's.find("\0")'
Median +- std dev: 1.65 ms +- 0.10 ms
Search an unlucky character (unpatched):
$ ./python -m perf timeit -s 's = "АБВГД"*10**5' -- 's.find("Є")'
Median +- std dev: 14.7 ms +- 1.8 ms
Search an unlucky character (patched):
$ ./python -m perf timeit -s 's = "АБВГД"*10**5' -- 's.find("Є")'
Median +- std dev: 2.17 ms +- 0.24 ms |
|
Date |
User |
Action |
Args |
2017-03-29 13:32:52 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, pitrou, vstinner, ned.deily, methane, python-dev, malin, azsorkin, xiang.zhang, louielu |
2017-03-29 13:32:52 | serhiy.storchaka | set | messageid: <1490794372.35.0.140395450638.issue24821@psf.upfronthosting.co.za> |
2017-03-29 13:32:52 | serhiy.storchaka | link | issue24821 messages |
2017-03-29 13:32:52 | serhiy.storchaka | create | |
|