-
Notifications
You must be signed in to change notification settings - Fork 29.5k
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
Explore mangling exported symbol names #180461
Comments
From a quick test, only a few patterns in our code seem to be causing issues:
|
For microsoft#180461 This prototype tries to mangle exported functions, saving a further 440kb from the bundle size
For microsoft#180461 This prototype tries to mangle exported functions, saving a further 440kb from the bundle size
Latest version increases total savings up to
|
For microsoft#180461 This prototype tries to mangle exported functions, saving a further 440kb from the bundle size
Targeting June to get this merged A few follow ups after this initial work is merged:
|
* Mangle exported functions For #180461 This prototype tries to mangle exported functions, saving a further 440kb from the bundle size * Fix missing call * Also try mangling top level exported consts too * Fixing errors * Don't run on build files * Skip a few more manglings and revert change to namespace * Skip a few more monaco files * Also mangle consts that shadow types This increases savings up to 3325 * Also mangle exported classes * Skip mangling more localization functions for now * Opt out pfs * Update build script * Run find locations task in parallel This should speed up compile * Cleanup before close * Limit workers to avoid hitting memory limit * Limit pool size * Skip one more mangling * Exclude entrypoints from mangling * Try to fix web build and clean up code * Exempt a few more projects * Exempt another file * Also exempt html * Skip mangling ext entrypoints * Use prefix that can't be confused with rpc calls * Fix max call stack error * Switch prefixes * Don't mangle ambient declarations * Use correct way of checking modifier flags * Workaround getCombinedModifierFlags not doing what I'd expect Maybe needs the checker to be enabled too? Just check parent chain instead for now * Clean up code and add logic showing how enum mangling could work * Remove a few more skipMangles Use entrypoints instead * Fix entrypoint name
Fixed by debcf16 |
Follow up on #165429
In #165429, we added managing of private fields in the VS Code codebase, resulting in a nice bundle size reduction
Looking through our shipped sources though, there is still lots of repeated text. One lower hanging branch we could try next is mangling exported functions. The
localize
function for instance seems to be used around 10000 times in the shipped sources, while as a less extreme case the common array functioncoalesce
appears 100 timesExported functions are a good candidate because we don't have to worry about them being serialized
With my simple prototype, mangling exported functions names saves an additional
446.412kb
on top of the mangled private property names (total size reduction is now2357.235kb
. Size savings will be smaller when the content is served compressed but it's still is a nice "free" size reductionThe text was updated successfully, but these errors were encountered: