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

perf(parser): reduce Token size to 8 bytes from 16 #8153

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

branchseer
Copy link
Contributor

@branchseer branchseer commented Dec 28, 2024

  • Replace end: u32 with len: u16. Ends of long tokens (which are rare) are stored in lexer.long_token_ends;
  • Pack bools into bitflags;
  • Now that end is calculated from start + len, start must be properly set. In some places they were not. This PR fixes them and adds a debug-assertion check in the lexer.

Copy link

graphite-app bot commented Dec 28, 2024

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot added A-parser Area - Parser C-performance Category - Solution not expected to change functional behavior, only performance labels Dec 28, 2024
@branchseer branchseer changed the title perf(parser): reduce Token size to 8 bytes from 12 perf(parser): reduce Token size to 8 bytes from 16 Dec 28, 2024
Copy link

codspeed-hq bot commented Dec 28, 2024

CodSpeed Performance Report

Merging #8153 will degrade performances by 13.21%

Comparing branchseer:token_eight_bytes (93f4f1a) with main (5234d96)

Summary

❌ 5 regressions
✅ 24 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main branchseer:token_eight_bytes Change
lexer[RadixUIAdoptionSection.jsx] 24 µs 26.4 µs -9.34%
lexer[antd.js] 22.3 ms 25.3 ms -11.98%
lexer[cal.com.tsx] 5.5 ms 6.3 ms -12.27%
lexer[checker.ts] 13.2 ms 14.8 ms -10.59%
lexer[pdf.mjs] 3.6 ms 4.1 ms -13.21%

@Boshen Boshen marked this pull request as draft December 28, 2024 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parser Area - Parser C-performance Category - Solution not expected to change functional behavior, only performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants