-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework readWord, switch identifier and whitespace to use lookup tables (
#358) Rather than generating a big tree of nested switches in the code, I generate a tree as a lookup table with pointers to other values in the table. Theoretically the two aren't so different, but this seems to perform a lot better in practice, maybe because of better branch prediction. I also changed whitespace and character detection to use a lookup table of size 64K (one for each UTF-16 code unit), which seems to actually work out fine especially since we'd only expect the first page to be in cache anyway. Still, I may want to explore an ASCII-only mode in the future. In the benchmark, this reduces readWord time from about 50ms to about 20ms, or about a 6% improvement overall. When running on a realistic codebase, this seems to improve overall performance by about 40%.
- Loading branch information
1 parent
9f62c81
commit 196f86e
Showing
25 changed files
with
908 additions
and
1,305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.