aboutsummaryrefslogtreecommitdiff
path: root/compiler/parser.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2021-05-01 01:23:54 +0900
committerRyo Nihei <nihei.dev@gmail.com>2021-05-02 14:40:46 +0900
commitedbca717ae82aea7cd4b693c907581531ba37706 (patch)
tree5d363fdabd6df90e7f4fbd619be759fc6ae55724 /compiler/parser.go
parentAdd character property expression (Meet RL1.2 of UTS #18 partially) (diff)
downloadtre-edbca717ae82aea7cd4b693c907581531ba37706.tar.gz
tre-edbca717ae82aea7cd4b693c907581531ba37706.tar.xz
Improve compilation time a little
A pattern like \p{Letter} generates an AST with many symbols concatenated by alt operators, which results in a large number of symbol positions in one state of the DFA. Such a pattern increases the compilation time. This commit improves the compilation time a little better. - To avoid calling astNode#first and astNode#last recursively, memoize the result of them. - Use a byte sequence that symbol positions are encoded to as a hash value to avoid using fmt.Fprintf function. - Implement a sort function for symbol positions instead of using sort.Slice function.
Diffstat (limited to 'compiler/parser.go')
0 files changed, 0 insertions, 0 deletions