-
-
Notifications
You must be signed in to change notification settings - Fork 485
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
base: main
Are you sure you want to change the base?
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
Token
size to 8 bytes from 12Token
size to 8 bytes from 16
CodSpeed Performance ReportMerging #8153 will degrade performances by 13.2%Comparing Summary
Benchmarks breakdown
|
# Conflicts: # crates/oxc_parser/src/lexer/token.rs # crates/oxc_parser/src/modifiers.rs
My local bench run shows the same regression on lexer, but also shows noticeable improvements on parser. I guess the lexer regression makes sense since the lexer now does more calculation but barely copies tokens on it own. Here's my local bench result of parser:
I suspected it was a cpu arch thing so I ran the parser bench under rosetta 2, only to see even more improvements:
Now I'm lost. @overlookmotel any insight on this? |
Thanks for investigating further. I did spend a couple of hours looking at this yesterday and scratching my head. I had to stop because I could feel a rabbit hole coming on and I had other tasks I needed to get on with! Please give me a few days to mull it over and I'll come back to you with some ideas. Also, #8298 may have an effect, as lots of work on One question in meantime:
What effect did you expect Rosetta 2 to have? Rosetta is an x86_64 emulator, right? (just checking I do know what I think I know!) |
Yeah I ran Rosetta 2 to check the bench result under x86_64. It was my wishful thinking that if Rosetta 2 gave the same result as codespeed, that would prove the improvements occur only on specific cpu archs (apple arm64). |
end: u32
withlen: u16
. Ends of long tokens (which are rare) are stored inlexer.long_token_ends
;end
is calculated fromstart + len
,start
must be properly set. In some places they were not. This PR fixes them and adds adebug-assertion
check in the lexer.