Skip to content

Conversation

@CPunisher
Copy link
Member

@CPunisher CPunisher commented Aug 12, 2025

Description:

  1. Separate CommentsBuffer into legacy and new ones with CommentsBufferTrait.
  2. For the new one, remove OneDirectionalList and use Vec. Record positions in LexerCheckpoint for recovery.

There's regression for legacy lexer. I'm not sure the reason.

@CPunisher CPunisher requested a review from a team as a code owner August 12, 2025 05:22
@changeset-bot
Copy link

changeset-bot bot commented Aug 12, 2025

⚠️ No Changeset found

Latest commit: a164f98

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

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 12, 2025

CodSpeed Performance Report

Merging #11000 will degrade performances by 3.51%

Comparing CPunisher:08-12-perf/comments (a164f98) with main (a4aa0ec)

Summary

⚡ 12 improvements
❌ 1 regressions
✅ 127 untouched benchmarks

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

Benchmarks breakdown

Benchmark BASE HEAD Change
es/lexer/cal-com 28.6 ms 29.6 ms -3.51%
es/parser/angular 19.6 ms 18.8 ms +4.18%
es/parser/backbone 3.1 ms 2.9 ms +5.97%
es/parser/cal-com 61.4 ms 59.2 ms +3.69%
es/parser/colors 86.6 µs 84 µs +3.04%
es/parser/jquery 15.8 ms 15 ms +5.15%
es/parser/jquery mobile 24.7 ms 23.5 ms +5.13%
es/parser/mootools 12.3 ms 11.9 ms +3.92%
es/parser/three 75.4 ms 73 ms +3.32%
es/parser/typescript 417.4 ms 402 ms +3.83%
es/parser/underscore 2.6 ms 2.5 ms +5.37%
es/parser/yui 12.1 ms 11.6 ms +4.58%
typescript/fast-strip 483.2 µs 457.4 µs +5.62%

@CPunisher

This comment was marked as resolved.

@CPunisher CPunisher marked this pull request as draft August 12, 2025 05:43
kdy1 pushed a commit that referenced this pull request Aug 12, 2025
**Description:**

There could be no need to clone entire lexer and parser when calling
`try_parse_xxx` in typescript. Here introduces checkpoints which only
contains necessary data to recover from failed trials. This is also the
prerequisite for #11000. And we
can also remove the `Rc<RefCell<T>>` in the lexer later

I'm not sure the data is completed for correctness. Let's see the test
results.
@CPunisher CPunisher force-pushed the 08-12-perf/comments branch from 3dc46df to a5a6315 Compare August 13, 2025 02:40
@socket-security

This comment was marked as duplicate.

@CPunisher CPunisher marked this pull request as ready for review August 13, 2025 06:33
@kdy1 kdy1 added this to the Planned milestone Aug 13, 2025
kdy1
kdy1 previously approved these changes Aug 13, 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.

Can you rebase?

@kdy1 kdy1 merged commit 0088ab8 into swc-project:main Aug 13, 2025
173 checks passed
@CPunisher CPunisher deleted the 08-12-perf/comments branch August 16, 2025 08:51
@kdy1 kdy1 modified the milestones: Planned, 1.13.4 Aug 21, 2025
@swc-project swc-project locked as resolved and limited conversation to collaborators Sep 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants