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(transformer/jsx): no string comparisons generating pragma expression #7620

Conversation

overlookmotel
Copy link
Contributor

@overlookmotel overlookmotel commented Dec 3, 2024

#7553 introduced support for some unusual JSX pragmas e.g. this.foo and import.meta.foo. We want to support these to pass tests, but they're very unlikely to be used in practice.

Identify these strange patterns when parsing the pragma (which happens only once per file), and encode them as an enum. The removes expensive string comparisons from Pragma::create_expression (which is called for every JSX element), and keeps the path for common cases fast.

Copy link

graphite-app bot commented Dec 3, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

Copy link
Contributor Author

overlookmotel commented Dec 3, 2024

@github-actions github-actions bot added A-transformer Area - Transformer / Transpiler C-performance Category - Solution not expected to change functional behavior, only performance labels Dec 3, 2024
@overlookmotel overlookmotel marked this pull request as ready for review December 3, 2024 16:00
Copy link

codspeed-hq bot commented Dec 3, 2024

CodSpeed Performance Report

Merging #7620 will not alter performance

Comparing 12-03-perf_transformer_jsx_no_string_comparisons_generating_pragma_expression (3b1e63e) with main (fcc2546)

Summary

✅ 29 untouched benchmarks

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Dec 4, 2024
Copy link
Member

Boshen commented Dec 4, 2024

Merge activity

  • Dec 3, 9:02 PM EST: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Dec 3, 9:02 PM EST: A user added this pull request to the Graphite merge queue.
  • Dec 3, 9:59 PM EST: A user merged this pull request with the Graphite merge queue.

@Boshen Boshen force-pushed the 12-03-refactor_transformer_jsx_pragma_parse_take_a_str_ branch from eb8bcdf to 171c635 Compare December 4, 2024 02:09
@Boshen Boshen force-pushed the 12-03-perf_transformer_jsx_no_string_comparisons_generating_pragma_expression branch from 67e3461 to d7b011f Compare December 4, 2024 02:09
…sion (#7620)

#7553 introduced support for some unusual JSX pragmas e.g. `this.foo` and `import.meta.foo`. We want to support these to pass tests, but they're very unlikely to be used in practice.

Identify these strange patterns when parsing the pragma (which happens only once per file), and encode them as an enum. The removes expensive string comparisons from `Pragma::create_expression` (which is called for every JSX element), and keeps the path for common cases fast.
@Boshen Boshen force-pushed the 12-03-refactor_transformer_jsx_pragma_parse_take_a_str_ branch from 171c635 to 8ad52be Compare December 4, 2024 02:48
@Boshen Boshen force-pushed the 12-03-perf_transformer_jsx_no_string_comparisons_generating_pragma_expression branch from d7b011f to 3b1e63e Compare December 4, 2024 02:48
Base automatically changed from 12-03-refactor_transformer_jsx_pragma_parse_take_a_str_ to main December 4, 2024 02:56
@graphite-app graphite-app bot merged commit 3b1e63e into main Dec 4, 2024
25 checks passed
@graphite-app graphite-app bot deleted the 12-03-perf_transformer_jsx_no_string_comparisons_generating_pragma_expression branch December 4, 2024 02:59
@oxc-bot oxc-bot mentioned this pull request Dec 4, 2024
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-transformer Area - Transformer / Transpiler C-performance Category - Solution not expected to change functional behavior, only performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants