You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Terser was locked in #4687 as we saw significant perf degradation from bumping the version further. Upon further investigation, it turns out this was due to a lack of hoisting:
In our CJS & ESM builds, NULL & UNDEFINED are not hoisted as constants but inlined throughout the bundle. For reasons that I still don't quite understand, hoisting these two, as newer versions of Terser will do, is a huge perf issue for us, causing double-digit regressions across the board. The byte impact is completely overshadowed by the perf hit, so, I've removed the NULL & UNDEFINED constants. We'll go back to using null & undefined/void 0 throughout the source.
Namespaces are a similar story; right now they're inlined, newer versions of Terser will hoist, but this is a very tiny byte reduction (we reference Math only once and XHTML & SVG twice each) with a 1-4% perf degradation in a few tests. Inlining them too seems better.
Edit: The perf regression is much larger w/ JIT enabled, disable it & hoisting is a slight improvement in some, still a regression in others. Not that it matters much ofc, just an interesting tidbit.
Therefore, the only real changes of this PR are as follows:
Switches us to patterns that match our desired output/perf characteristics w/ modern Terser
Matches the UMD build to our CJS & ESM builds
It's probably safe to assume it largely matches the performance characteristics of the CJS & ESM builds, and if so, it's likely slower than it should be due to the hoisting that only it is receiving at the moment.
Compat's version is now hoisted too, instead of inlined into the CJS exports. Harder to fix (or at least, I'm not sure how to) as we don't easily control how the exports are generated.
i.e., exports.version = '18.3.1' has become exports.version = P
No worries if we want to just stick w/ older Terser, I mostly did this as an exploration as I was curious. There's no definite advantage here (I could go bench UMD builds I suppose though), just refactoring us so new Terser lines up with our old Terser output.
For whatever reason, type inference has failed for NULL, so oldVNode was actually any. As such, this is a legitimate (internal) type mismatch in what diff expects as a parameter and what we provide. Will fix separately.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Terser was locked in #4687 as we saw significant perf degradation from bumping the version further. Upon further investigation, it turns out this was due to a lack of hoisting:
In our CJS & ESM builds,
NULL&UNDEFINEDare not hoisted as constants but inlined throughout the bundle. For reasons that I still don't quite understand, hoisting these two, as newer versions of Terser will do, is a huge perf issue for us, causing double-digit regressions across the board. The byte impact is completely overshadowed by the perf hit, so, I've removed theNULL&UNDEFINEDconstants. We'll go back to usingnull&undefined/void 0throughout the source.Namespaces are a similar story; right now they're inlined, newer versions of Terser will hoist, but this is a very tiny byte reduction (we reference Math only once and XHTML & SVG twice each) with a 1-4% perf degradation in a few tests. Inlining them too seems better.
Edit: The perf regression is much larger w/ JIT enabled, disable it & hoisting is a slight improvement in some, still a regression in others. Not that it matters much ofc, just an interesting tidbit.
Therefore, the only real changes of this PR are as follows:
versionis now hoisted too, instead of inlined into the CJS exports. Harder to fix (or at least, I'm not sure how to) as we don't easily control how the exports are generated.exports.version = '18.3.1'has becomeexports.version = PNo worries if we want to just stick w/ older Terser, I mostly did this as an exploration as I was curious. There's no definite advantage here (I could go bench UMD builds I suppose though), just refactoring us so new Terser lines up with our old Terser output.