Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use lookup tables instead of linear search with memchr #625

Closed
wants to merge 2 commits into from
Closed

Use lookup tables instead of linear search with memchr #625

wants to merge 2 commits into from

Commits on Apr 23, 2022

  1. Use lookup tables instead of linear search with memchr

    Several places use `memchr` with a byteset. This commit refactors these
    code paths to construct a lookup table from `u8` -> `bool`, where an
    index is set to `true` if the byte is present in the given slice.
    
    This change removes linear scans that occur in loops, which changes
    these functions runtime complexity from `O(m * n)` to `O(m + n)`.
    lopopolo committed Apr 23, 2022
    Configuration menu
    Copy the full SHA
    9175e6e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    cd1d23c View commit details
    Browse the repository at this point in the history