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

Statically computes text value kind lookup table #894

Merged
merged 2 commits into from
Jan 9, 2025
Merged

Conversation

zslayton
Copy link
Contributor

@zslayton zslayton commented Jan 9, 2025

Builds on #892, the PR to port to winnow.

I thought there might be a performance boost to be had by computing the mapping from a text value's first byte to the value's kind at compile time and using a lookup table at runtime. Strangely, it didn't change the performance at all--benchmark results are identical.

I'm inclined to merge this anyway just so people don't spend time following the same line of reasoning in the future. Subjectively, it's a bit tidier.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@zslayton zslayton marked this pull request as ready for review January 9, 2025 15:09
Copy link

codecov bot commented Jan 9, 2025

Codecov Report

Attention: Patch coverage is 63.93443% with 22 lines in your changes missing coverage. Please review.

Project coverage is 77.46%. Comparing base (0943766) to head (67d3db7).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/lazy/text/token_kind.rs 0.00% 17 Missing ⚠️
src/lazy/expanded/mod.rs 0.00% 1 Missing and 2 partials ⚠️
src/lazy/expanded/macro_evaluator.rs 0.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #894      +/-   ##
==========================================
- Coverage   77.49%   77.46%   -0.04%     
==========================================
  Files         136      137       +1     
  Lines       34247    34238       -9     
  Branches    34247    34238       -9     
==========================================
- Hits        26541    26521      -20     
- Misses       5728     5735       +7     
- Partials     1978     1982       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Base automatically changed from winnow-experiment to main January 9, 2025 18:02
@zslayton zslayton merged commit ab0ada4 into main Jan 9, 2025
33 checks passed
@zslayton zslayton deleted the text-lookup-table branch January 9, 2025 21:12
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