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

feat(transformer): async-to-generator plugin. #5590

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

7086cmd
Copy link
Contributor

@7086cmd 7086cmd commented Sep 7, 2024

Tests are still not passed. A lot need to do yet.

Copy link

graphite-app bot commented Sep 7, 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.

@7086cmd 7086cmd force-pushed the feat/transform-async-to-generator branch from 136bfbc to aad667e Compare September 7, 2024 16:45
@github-actions github-actions bot added the A-transformer Area - Transformer / Transpiler label Sep 7, 2024
Copy link

codspeed-hq bot commented Sep 7, 2024

CodSpeed Performance Report

Merging #5590 will degrade performances by 89.96%

Comparing 7086cmd:feat/transform-async-to-generator (d79face) with main (2386d7f)

Summary

❌ 5 regressions
✅ 24 untouched benchmarks

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

Benchmarks breakdown

Benchmark main 7086cmd:feat/transform-async-to-generator Change
transformer[RadixUIAdoptionSection.jsx] 161.7 µs 210.3 µs -23.1%
transformer[antd.js] 31.5 ms 313.5 ms -89.96%
transformer[cal.com.tsx] 62.5 ms 87.8 ms -28.78%
transformer[checker.ts] 28.8 ms 111.5 ms -74.15%
transformer[pdf.mjs] 10.5 ms 33.8 ms -68.99%

@7086cmd
Copy link
Contributor Author

7086cmd commented Sep 7, 2024

It appears that the iteration of the ast tree incurs performance degradation. However, it necessitates the duplication of statements for replacement. Are there alternative approaches that could be considered?

@7086cmd 7086cmd force-pushed the feat/transform-async-to-generator branch from 45a0ff9 to 3d069a3 Compare September 7, 2024 23:05
@Dunqing Dunqing requested review from Dunqing, Boshen and overlookmotel and removed request for Dunqing, Boshen and overlookmotel September 9, 2024 03:42
@Boshen
Copy link
Member

Boshen commented Sep 9, 2024

@7086cmd Can you hold onto this and let us take a look first? We may end up implementing this differently with architectural changes.

@7086cmd
Copy link
Contributor Author

7086cmd commented Sep 9, 2024

@7086cmd Can you hold onto this and let us take a look first? We may end up implementing this differently with architectural changes.

Ok. It does need some refactor, especially when it comes some polyfills here, we'd better do as what babel does: from js text to ast, which is visually more vibrant and more convenient. Replacing to multiple statements is also a handful problem.

@7086cmd
Copy link
Contributor Author

7086cmd commented Sep 9, 2024

For this PR, I would prefer what esbuild does: more visible and no need for refactor for multiple statements here: https://esbuild.github.io/try/#dAAwLjIzLjEALS10YXJnZXQ9Y2hyb21lNTAAYXN5bmMgZnVuY3Rpb24gYSgpIHsKICAgIGF3YWl0IDE7Cn0KCmFzeW5jIChkKSA9PiB7CiAgICBhd2FpdCAyOwogICAgYXdhaXQgZCgpCn0K.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-transformer Area - Transformer / Transpiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants