gdamore / dcell

Terminal Cells implemented for D
Boost Software License 1.0
13 stars 1 forks source link

Escape parsing could use some kind of trie for performance #5

Open gdamore opened 2 years ago

gdamore commented 2 years ago

We are relying on a hacky bespoke algorithm to parse escape sequences, but it is inefficient as we have to scan all possibility each time a a character is added. Using a trie would let us quickly match the character. We could also keep some kind of state about progress in the trie in the parser.

This is probably a substantial performance improvement on input parsing, although input parsing is probably not a super performance sensitive concern for most applications. The current hacky solution seems to work well enough to be reasonably responsive for most cases.