swc icon indicating copy to clipboard operation
swc copied to clipboard

chore: remove unconditioned instrument code

Open stormslowly opened this issue 2 months ago • 8 comments

To check if tracing has a performance cost

Description:

BREAKING CHANGE:

Related issue (if exists):

stormslowly avatar Nov 06 '25 03:11 stormslowly

⚠️ No Changeset found

Latest commit: 182dc3a2b0cead0f28f62aa6741728dc606c96a7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Nov 06 '25 03:11 changeset-bot[bot]

It has a noticeable cost. You can try enabling tracing/max_level_off

kdy1 avatar Nov 06 '25 03:11 kdy1

CodSpeed Performance Report

Merging #11237 will not alter performance

Comparing stormslowly:chore/try_no_instrument (182dc3a) with main (d93ec90)

Summary

✅ 138 untouched

codspeed-hq[bot] avatar Nov 06 '25 03:11 codspeed-hq[bot]

In rspack-resolver, when I enable max_level_off and release_max_level_off, I still get 2~15% performance loss in benchmark.

stormslowly avatar Nov 06 '25 03:11 stormslowly

Binary Sizes

File Size
swc.linux-x64-gnu.node 31M (31818120 bytes)

Commit: f4fda6e6a3192d6c4dd39971b49bf24d36f45538

github-actions[bot] avatar Nov 06 '25 03:11 github-actions[bot]

I think it's a good idea to remove all tracing code, considering the perf difference

kdy1 avatar Nov 06 '25 07:11 kdy1

According to codspeed's report, the most improved step is enabling max_level_off. That's quite different from rspack-resolver's case. I will do some digging to find the season and figure out a way to improve performance and keep trackability.

stormslowly avatar Nov 06 '25 07:11 stormslowly