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): Use Cow for _ in numeric literals #7031

Merged
merged 4 commits into from Mar 8, 2023

Conversation

kdy1
Copy link
Member

@kdy1 kdy1 commented Mar 8, 2023

Description:

@kdy1 kdy1 added this to the Planned milestone Mar 8, 2023
@kdy1 kdy1 self-assigned this Mar 8, 2023
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_ecma_parser

@kdy1 kdy1 marked this pull request as ready for review March 8, 2023 02:16
kodiakhq[bot]
kodiakhq bot previously approved these changes Mar 8, 2023
@kdy1 kdy1 enabled auto-merge (squash) March 8, 2023 02:16
@Boshen
Copy link

Boshen commented Mar 8, 2023

Excuse me for the lack of knowledge here, but I don't see how this removes the allocation from raw_val.replace('_', "")?

What I did for my lexer (copied from jsparagus) was to use the Cow technique, where we only own the string if there is a _.

@kdy1
Copy link
Member Author

kdy1 commented Mar 8, 2023

This PR does not remove allocation of replace call

@kdy1
Copy link
Member Author

kdy1 commented Mar 8, 2023

I'll remove it too

kodiakhq[bot]
kodiakhq bot previously approved these changes Mar 8, 2023
kodiakhq[bot]
kodiakhq bot previously approved these changes Mar 8, 2023
kodiakhq[bot]
kodiakhq bot previously approved these changes Mar 8, 2023
@kdy1 kdy1 disabled auto-merge March 8, 2023 04:32
@kdy1 kdy1 changed the title perf(es/parser): Don't allocate while reading numbers perf(es/parser): Use Cow for _ Mar 8, 2023
@kdy1 kdy1 changed the title perf(es/parser): Use Cow for _ perf(es/parser): Use Cow for _ in numeric literals Mar 8, 2023
@kdy1 kdy1 enabled auto-merge (squash) March 8, 2023 04:33
@kdy1 kdy1 merged commit 30546a2 into swc-project:main Mar 8, 2023
@kdy1 kdy1 deleted the inline branch March 8, 2023 04:54
@kdy1 kdy1 removed this from the Planned milestone Mar 10, 2023
@kdy1 kdy1 added this to the v1.3.39 milestone Mar 10, 2023
@swc-project swc-project locked as resolved and limited conversation to collaborators Apr 9, 2023
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.

None yet

2 participants