aboutsummaryrefslogtreecommitdiff
path: root/compiler/symbol_position.go (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Use new parser and DFA compilerRyo Nihei2021-12-101-198/+0
|
* Improve performance of the symbolPositionSetRyo Nihei2021-05-041-26/+53
| | | | | | | | | | When using a map to represent a set, performance degrades due to the increased number of calls of runtime.mapassign. Especially when the number of symbols is large, as in compiling a pattern that contains character properties like \p{Letter}, adding elements to the set alone may take several tens of seconds of CPU time. Therefore, this commit solves this problem by changing the representation of the set from map to array.
* Improve compilation time a littleRyo Nihei2021-05-021-0/+171
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.