-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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(next-swc): introduce experimental tracing support for swc #35803
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
a042bd6
to
298a585
Compare
8960336
to
bba8b56
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
Should we output the trace to the |
I do not have strong preferences for this - this is mostly modeling after others like |
This comment has been minimized.
This comment has been minimized.
b8f9130
to
7560bd4
Compare
Updated PR bit
|
dcff441
to
43c6655
Compare
05126e8
to
b290b0c
Compare
2331f8a
to
5fde511
Compare
Context: #34687 (comment)
It is a bit tricky to understand underlying performance characteristics inside swc when build steps involving swc's internals. Technically it should be possible to use a profiler with some custom swc build, but it is not easy job to set it up.
SWC recently introduced trace features for those reasons (swc-project/swc#3953), allow emitting Trace event format compatible (https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview) output. This PR ports over those features into
next-swc
underexperimental
config value to user to try out.With this PR, trace will emit core swc's traces as well as one custom transformation in next-swc (
emotion
). Expect to expand trace over all existing custom transform passes eventually in further PRs.To configure traces,
next.config.js
exposes this new experimental config value:SWC will generate
trace-${unixtimestamp}.json
by default.It is important to aware enabling trace all time is highly discouraged: observing code path is not free, and if build scales up trace will cost expensive time as well. User may want to use env variable, or other dynamic way to selectively enable trace instead.
Generated trace is compatible to trace event format, so existing visualizer can be used out of the box. Notably,
And possibly other flamegraph visualizer as well. Technically it is possible to make output to work with chrome devtools' profiler, but that's not supported now.
This is example trace screenshot from
bench/nested-deps
.As config already implies, this is experimental due to 1. config / internal swc impl might change, 2. there are missing traces for custom passes in next-swc.
Bug
fixes #number
contributing.md
Feature
fixes #number
contributing.md
Documentation / Examples
yarn lint