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

ci(benchmark): make lexer benchmark more realistic #8573

Merged

Conversation

overlookmotel
Copy link
Contributor

@overlookmotel overlookmotel commented Jan 17, 2025

The lexer benchmarks had a problem. The lexer alone cannot make sense of regexp literals, template literals, or JSX text elements - it needs the parser "driving" it.

So lexer was producing plenty of errors on some benchmarks. This is unrealistic - when driven by the parser, the lexer produces no errors. Generating diagnostics is relatively expensive, so this was skewing the benchmarks somewhat.

Solve this by cleaning up the input source text to replace these syntaxes with string literals prior to running the benchmarks.

Unfortunately lexer benchmarks don't exercise the code paths for these syntaxes, but there isn't much we can do about that. We can judge by the parser benchmarks, which are the more important ones anyway.

@github-actions github-actions bot added the A-parser Area - Parser label Jan 17, 2025
Copy link
Contributor Author

overlookmotel commented Jan 17, 2025


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.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@overlookmotel overlookmotel marked this pull request as ready for review January 17, 2025 21:38
Copy link

codspeed-hq bot commented Jan 17, 2025

CodSpeed Performance Report

Merging #8573 will improve performances by 14.71%

Comparing 01-17-ci_benchmark_make_lexer_benchmark_more_realistic (bfd0b0d) with main (76ea52b)

Summary

⚡ 1 improvements
✅ 31 untouched benchmarks

Benchmarks breakdown

Benchmark main 01-17-ci_benchmark_make_lexer_benchmark_more_realistic Change
lexer[RadixUIAdoptionSection.jsx] 23.8 µs 20.8 µs +14.71%

Copy link

graphite-app bot commented Jan 18, 2025

Merge activity

The lexer benchmarks had a problem. The lexer alone cannot make sense of regexp literals, template literals, or JSX text elements - it needs the parser "driving" it.

So lexer was producing plenty of errors on some benchmarks. This is unrealistic - when driven by the parser, the lexer produces no errors. Generating diagnostics is relatively expensive, so this was skewing the benchmarks somewhat.

Solve this by cleaning up the input source text to replace these syntaxes with string literals prior to running the benchmarks.

Unfortunately lexer benchmarks don't exercise the code paths for these syntaxes, but there isn't much we can do about that. We can judge by the parser benchmarks, which are the more important ones anyway.
@Boshen Boshen force-pushed the 01-17-ci_benchmark_make_lexer_benchmark_more_realistic branch from c206be3 to bfd0b0d Compare January 18, 2025 01:47
@graphite-app graphite-app bot merged commit bfd0b0d into main Jan 18, 2025
27 checks passed
@graphite-app graphite-app bot deleted the 01-17-ci_benchmark_make_lexer_benchmark_more_realistic branch January 18, 2025 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0-merge Merge with Graphite Merge Queue A-parser Area - Parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant