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

Speed-up HTML escaping by using equal sized entities #55

Merged
merged 1 commit into from
Jul 8, 2024

Commits on Jul 7, 2024

  1. Speed-up HTML escaping by using equal sized entities

    By using codepoint entities like `'&'` → `"&rinja-rs#38;"`, we have a much
    smaller lookup table (58 bytes instead of 29× pointer size ~= 232
    bytes). This makes the cache happy, and the benchmark run about ~20%
    faster.
    
    ```text
    $ cargo bench --bench escape
    Escaping                time:   [3.4087 µs 3.4126 µs 3.4168 µs]
                            change: [-19.790% -19.580% -19.354%] (p = 0.00 < 0.05)
                            Performance has improved.
    ```
    Kijewski committed Jul 7, 2024
    Configuration menu
    Copy the full SHA
    1017451 View commit details
    Browse the repository at this point in the history