Skip to content

Added table-based parser for is_alphanumeric/etc functions#18

Merged
remkade merged 1 commit intomainfrom
table-based-parsing
Nov 10, 2022
Merged

Added table-based parser for is_alphanumeric/etc functions#18
remkade merged 1 commit intomainfrom
table-based-parsing

Conversation

@AndrewVallette
Copy link
Collaborator

Using a table-based parser provides better performance than the is_alpha/is_digit/etc functions in nom. This is due to the reduced number of comparisons that are performed for each character.

nom's functions work by checking if a character is within a specified range (or set of ranges), which requires multiple comparisons. The table-based lookup works by checking if the character is in one of the classes defined below, which requires only a single comparison. The table is very small (256 bytes) and is likely to remain in cache.

This can be expanded upon in the future (e.g., refactoring selector_parse to use a table), which will provide another noticeable increase in performance.

@remkade remkade merged commit 55377e9 into main Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants