Message303617
Serhiy: "Victor, how large is performance regression of your patch?"
I tested bm_regex_compile.py of the Python performance benchmark suite:
https://pyperformance.readthedocs.io/benchmarks.html#regex-compile
My patch has no impact on *uncached* re.compile() performances according to this benchmark.
haypo@selma$ ./python -m perf compare_to ref.json patch.json
Benchmark hidden because not significant (1): regex_compile
haypo@selma$ ./python -m perf compare_to ref.json patch.json -v
Mean +- std dev: [ref] 386 ms +- 6 ms -> [patch] 387 ms +- 6 ms: 1.00x slower (+0%)
Not significant!
--
On a microbenchmark on the *cache* itself, the difference is visible:
1018 ./python -m perf timeit -s 'import re; re_compile=re.compile' 're_compile("a", flags=2)' --duplicate=1024 -o ref.json --inherit=PYTHONPATH -v
1019 git co re_compile_flags_type
1020 make
1021 ./python -m perf timeit -s 'import re; re_compile=re.compile' 're_compile("a", flags=2)' --duplicate=1024 -o patch.json --inherit=PYTHONPATH -v
1022 ./python -m perf compare_to ref.json patch.json
1023 git diff master..
haypo@selma$ ./python -m perf compare_to ref.json patch.json
Mean +- std dev: [ref] 364 ns +- 6 ns -> [patch] 459 ns +- 10 ns: 1.26x slower (+26%)
If you replace type(flags) with flags.__class__, the change has no impact on performances :-) But obj.__class__ can be different than type(obj). |
|
Date |
User |
Action |
Args |
2017-10-03 13:51:37 | vstinner | set | recipients:
+ vstinner, methane, serhiy.storchaka |
2017-10-03 13:51:37 | vstinner | set | messageid: <1507038697.63.0.213398074469.issue31671@psf.upfronthosting.co.za> |
2017-10-03 13:51:37 | vstinner | link | issue31671 messages |
2017-10-03 13:51:37 | vstinner | create | |
|