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(es/fast-lexer): replace PHF with static keyword lookup table #10181

Merged
merged 1 commit into from
Mar 12, 2025

Conversation

GiveMe-A-Name
Copy link
Contributor

Description:

Replaces the perfect hash function (PHF) keyword lookup with a more performant static keyword lookup table. The new implementation:

  • Removes dependency on phf crate
  • Adds a custom static keyword lookup mechanism
  • Introduces a more cache-friendly keyword search algorithm
  • Adds support for the module keyword

BREAKING CHANGE:

Related issue (if exists):

Replaces the perfect hash function (PHF) keyword lookup with a more performant static keyword lookup table. The new implementation:

- Removes dependency on `phf` crate
- Adds a custom static keyword lookup mechanism
- Introduces a more cache-friendly keyword search algorithm
- Adds support for the `module` keyword
@GiveMe-A-Name GiveMe-A-Name requested review from a team as code owners March 12, 2025 02:39
Copy link

changeset-bot bot commented Mar 12, 2025

⚠️ No Changeset found

Latest commit: c8c37d3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@GiveMe-A-Name GiveMe-A-Name marked this pull request as draft March 12, 2025 02:40
@GiveMe-A-Name GiveMe-A-Name marked this pull request as ready for review March 12, 2025 03:13
Copy link

codspeed-hq bot commented Mar 12, 2025

CodSpeed Performance Report

Merging #10181 will improve performances by 10.4%

Comparing GiveMe-A-Name:perf/fast-keyword-lookup-table (c8c37d3) with main (bccdafc)

Summary

⚡ 8 improvements
✅ 144 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
es/fast-lexer/angular 9.5 ms 8.8 ms +8.01%
es/fast-lexer/backbone 1.2 ms 1.1 ms +8.55%
es/fast-lexer/jquery 6.4 ms 5.8 ms +9.67%
es/fast-lexer/jquery mobile 10.4 ms 9.6 ms +8.89%
es/fast-lexer/mootools 5.1 ms 4.6 ms +9.65%
es/fast-lexer/three 31.2 ms 28.3 ms +10.4%
es/fast-lexer/underscore 996.8 µs 905.1 µs +10.13%
es/fast-lexer/yui 5.8 ms 5.4 ms +5.65%

@kdy1 kdy1 added this to the Planned milestone Mar 12, 2025
Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, thank you!

@kdy1 kdy1 merged commit 56d065e into swc-project:main Mar 12, 2025
169 checks passed
@kdy1 kdy1 modified the milestones: Planned, v1.11.9 Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants