diff options
author | Alexis Roda <alexis.roda.villalonga@gmail.com> | 2019-04-07 13:09:23 +0200 |
---|---|---|
committer | Alexis Roda <alexis.roda.villalonga@gmail.com> | 2019-07-26 21:43:01 +0200 |
commit | 9dc95398e2b2d09be884d71b0dbc6705d7715a2b (patch) | |
tree | d47515fd6d6c48490dfa3f911e51e3ade71684dc /tests | |
parent | c4de499db06c6343cd741d27f4ed4d6d878aad46 (diff) | |
download | z80count-9dc95398e2b2d09be884d71b0dbc6705d7715a2b.tar.gz z80count-9dc95398e2b2d09be884d71b0dbc6705d7715a2b.zip |
Compile regexes lazyly.
Profiling shows that compiling the regexes takes most of the execution
time. Compiling them when needed instead of compiling all of them
upfront decreases execution time from 0.70 to 0.12 seconds.
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
6/1 0.000 0.000 0.702 0.702 {built-in method builtins.exec}
1 0.001 0.001 0.702 0.702 z80count.py:24(<module>)
1 0.000 0.000 0.696 0.696 z80count.py:104(main)
1 0.000 0.000 0.692 0.692 z80count.py:65(__init__)
1 0.005 0.005 0.692 0.692 z80count.py:77(_load_table)
1888 0.001 0.000 0.680 0.000 re.py:232(compile)
1891 0.017 0.000 0.680 0.000 re.py:271(_compile)
1631 0.009 0.000 0.647 0.000 sre_compile.py:759(compile)
1631 0.006 0.000 0.325 0.000 sre_parse.py:919(parse)
3263/1631 0.008 0.000 0.312 0.000 sre_parse.py:417(_parse_sub)
1631 0.003 0.000 0.306 0.000 sre_compile.py:598(_code)
3266/1632 0.115 0.000 0.305 0.000 sre_parse.py:475(_parse)
16700/1631 0.112 0.000 0.246 0.000 sre_compile.py:71(_compile)
131243 0.061 0.000 0.086 0.000 sre_parse.py:164(__getitem__)
1631 0.007 0.000 0.057 0.000 sre_compile.py:536(_compile_info)
18331/3262 0.043 0.000 0.053 0.000 sre_parse.py:174(getwidth)
48041 0.018 0.000 0.047 0.000 sre_parse.py:254(get)
9741 0.030 0.000 0.039 0.000 sre_compile.py:276(_optimize_charset)
52307 0.033 0.000 0.033 0.000 sre_parse.py:233(__next)
13432 0.010 0.000 0.029 0.000 sre_compile.py:423(_simple)
173223/156520 0.021 0.000 0.026 0.000 {built-in method builtins.len}
237477 0.024 0.000 0.024 0.000 {method 'append' of 'list' objects}
142999 0.022 0.000 0.022 0.000 {built-in method builtins.isinstance}
9741 0.016 0.000 0.019 0.000 sre_compile.py:249(_compile_charset)
43579 0.014 0.000 0.018 0.000 sre_parse.py:160(__len__)
30678 0.010 0.000 0.014 0.000 sre_parse.py:172(append)
1631 0.001 0.000 0.012 0.000 sre_parse.py:96(closegroup)
1631 0.004 0.000 0.011 0.000 enum.py:827(__and__)
19310 0.009 0.000 0.011 0.000 sre_parse.py:286(tell)
35044 0.011 0.000 0.011 0.000 {built-in method builtins.min}
10767 0.007 0.000 0.010 0.000 sre_parse.py:343(_escape)
23891 0.006 0.000 0.008 0.000 sre_parse.py:249(match)
16701 0.008 0.000 0.008 0.000 sre_parse.py:111(__init__)
3270 0.003 0.000 0.006 0.000 enum.py:281(__call__)
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions