Age | Commit message (Collapse) | Author |
|
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__)
|
|
Instead of a flat table of regexes this implementation groups regexes
by mnemonic, making lookup faster.
The implementation is encaptulated in its own class "Parser".
|
|
Regexes hare a common prefix and suffix. Remove them from the json
file in order to make it more readable and add them in python code
when parsing the file.
|
|
|
|
Minor refactor in order to improve testability.
Note: tests have been automatically generated from data found in an
spreadsheet and probably need some cleanup.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
It is used by SDCC and for example (ix+0) is 0(ix), which is uncommon.
|
|
|
|
|
|
|
|
|
|
|
|
|