Closed CPunisher closed 3 weeks ago
Latest commit: e13be3e24a8d71435d310727eebb1075ece38824
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Comparing CPunisher:feat/switch-side-effect
(e13be3e) with main
(2bbd1e8)
⚡ 1
improvements
✅ 193
untouched benchmarks
Benchmark | main |
CPunisher:feat/switch-side-effect |
Change | |
---|---|---|---|---|
⚡ | es/full/bugs-1 |
548 µs | 522.4 µs | +4.91% |
Description:
This is learnt from https://github.com/terser/terser/pull/1044 Key point: all the cases (statements) after the last side-effect and non-terminated one are useless.
There are also some points on whether a statement is side-effect free:
This is an existing bug. I'm not sure whether we should fix it since it is a very bad code and I also find some similar bad cases with terser.
~I'm also not sure it's appropriate to introduce context variable
in_strict
forStmtExt:: may_have_side_effects
, becausein_strict
could change fromfalse
totrue
. But this is a conservative mistake and does not break the program. Maybe we should use visitor for context-aware side effect checker in the future.~Related issue: