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 skip instead of scan in Lexer #102

Closed

Conversation

krzysiek1507
Copy link

It looks like we can use skip instead of scan in Lexer and save quite a lot allocations. We don't use the result of scan so we don't need the allocations.

For parsing spec/fixtures/context/basic.y:

Before:

Warming up --------------------------------------
              master    59.000  i/100ms
Calculating -------------------------------------
              master    606.783  (± 2.8%) i/s -      3.068k in   5.060887s
Calculating -------------------------------------
              master   131.059k memsize (     0.000  retained)
                         1.975k objects (     0.000  retained)
                        50.000  strings (     0.000  retained)

After:

Warming up --------------------------------------
              master    61.000  i/100ms
Calculating -------------------------------------
              master    615.521  (± 1.3%) i/s -      3.111k in   5.055099s
Calculating -------------------------------------
              master   119.339k memsize (     0.000  retained)
                         1.682k objects (     0.000  retained)
                        50.000  strings (     0.000  retained)

@krzysiek1507
Copy link
Author

Hey @yui-knk is this PR worth merging? I have a few more performance fixes in my local repo

@krzysiek1507 krzysiek1507 deleted the krzysiek1507/use-skip-lexer branch November 22, 2023 10:16
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.

1 participant