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 vstinner
Recipients barry, ethan.furman, gvanrossum, methane, rhettinger, serhiy.storchaka, vstinner
Date 2017-10-05.10:10:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1507198257.52.0.213398074469.issue31671@psf.upfronthosting.co.za>
In-reply-to
Content
Hum, I ran again my microbenchmark on re.compile() cache:

haypo@selma$ ./python -m perf timeit -s 'import re; re_compile=re.compile' 're_compile("a", flags=2)' --duplicate=1024 -o ref.json  --inherit=PYTHONPATH -v

Sadly, the commit c1c47c166b1012d34f2c6e111ee9ccb5c4d12de7 made the cache slower:

Mean +- std dev: [ref] 364 ns +- 26 ns -> [patch] 545 ns +- 19 ns: 1.50x slower (+50%)

Just to check, I reverted the change on Scanner, the benchmark is still "560 ns +- 27 ns".


"if isinstance(flags, RegexFlag): flags = flags.value" added 181 nanoseconds? A quick "isinstance(flags, RegexFlag)" timeit microbenchmark says that this operation has a cost of 46.2 ns (+- 1.6 ns). Benchmarks are strange, as usual :-)
History
Date User Action Args
2017-10-05 10:10:57vstinnersetrecipients: + vstinner, gvanrossum, barry, rhettinger, methane, ethan.furman, serhiy.storchaka
2017-10-05 10:10:57vstinnersetmessageid: <1507198257.52.0.213398074469.issue31671@psf.upfronthosting.co.za>
2017-10-05 10:10:57vstinnerlinkissue31671 messages
2017-10-05 10:10:57vstinnercreate