STINNER Victor <victor.stin...@gmail.com> added the comment:

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 
:-)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31671>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to