-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Description
Summary
Strip-only mode appears to collect parser comments even though comments are not used in that mode.
Evidence
- Comments storage is always initialized:
crates/swc_ts_fast_strip/src/lib.rs:246. - Lexer always receives
Some(&comments):crates/swc_ts_fast_strip/src/lib.rs:248-253. - In
Mode::StripOnly, output is produced by mutating the original source bytes; no comment map is consulted.
Why this is a performance risk
Comment collection adds parser-side bookkeeping and memory overhead on every strip-only call, even though the comment data is unused on that path.
Suggested direction
- Pass
Nonefor comments when running strip-only mode. - Keep comment collection for transform mode where fixer/codegen paths may rely on comment metadata.
Benchmark idea
Measure strip-only throughput and allocations before/after disabling comment collection for strip-only.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels