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/parser): Optimize lexing of template literals #9036

Merged
merged 3 commits into from
Jun 11, 2024

Conversation

kdy1
Copy link
Member

@kdy1 kdy1 commented Jun 11, 2024

Description:

We don't need to push one char at a time.

@kdy1 kdy1 added this to the Planned milestone Jun 11, 2024
@kdy1 kdy1 self-assigned this Jun 11, 2024
@kdy1 kdy1 requested a review from a team as a code owner June 11, 2024 11:43
kodiakhq[bot]
kodiakhq bot previously approved these changes Jun 11, 2024
Copy link
Member Author

@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.

swc-bump:

  • swc_core
  • swc_ecma_parser

@kdy1 kdy1 enabled auto-merge (squash) June 11, 2024 11:44
raw.push(c);
raw_slice_start = self.cur_pos();
} else {
self.bump();

if let Ok(ref mut cooked) = cooked {
cooked.push(c);
Copy link

Choose a reason for hiding this comment

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

Should cooked have the same optimization?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think so. I'll patch it tomorrow.

@kdy1 kdy1 disabled auto-merge June 11, 2024 12:04
@kdy1 kdy1 enabled auto-merge (squash) June 11, 2024 12:19
@kdy1 kdy1 disabled auto-merge June 11, 2024 12:19
@kdy1 kdy1 merged commit 6ab19a1 into swc-project:main Jun 11, 2024
150 checks passed
@kdy1 kdy1 deleted the parser-tpl branch June 11, 2024 12:20
kdy1 added a commit that referenced this pull request Jun 12, 2024
**Description:**

Applies same trick as #9036, but for `cooked`
@kdy1 kdy1 modified the milestones: Planned, v1.5.29 Jun 13, 2024
kdy1 added a commit to vercel/turborepo that referenced this pull request Jun 13, 2024
### Description

Update `swc_core` to `v0.93.4`.

To apply swc-project/swc#9036 and swc-project/swc#9037. Those PR makes parsing of some files 5x faster.


### Testing Instructions

See next.js counterpart: vercel/next.js#66781
kdy1 added a commit to vercel/next.js that referenced this pull request Jun 13, 2024
### What?

Update `swc_core` to `v0.93.4`.

### Why?

To apply swc-project/swc#9036 and swc-project/swc#9037. Those PR makes parsing of some files 5x faster.

### How?
@swc-project swc-project locked as resolved and limited conversation to collaborators Jul 13, 2024
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