Skip to content

deps: Improve Webpack build performance #2288

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

Merged
merged 13 commits into from
Jan 14, 2025
Merged

Conversation

SuaYoo
Copy link
Member

@SuaYoo SuaYoo commented Jan 8, 2025

Context

Related to #2266, changes in Webpack only to improve build and rebuild performance.

Production build benchmark tests running hyperfine --show-output --shell zsh --warmup 3 'yarn build':

webpack version webpack-cli version Parallelized? Time Range
5.88.0 4.8.0 No 16.962 s ± 0.983 s 15.796 s … 19.364 s
5.97.1 5.1.4 No 15.559 s ± 0.159 s 15.082 s ± 0.207 s
5.97.1 5.1.4 Yes 15.559 s ± 0.159 s 14.712 s … 15.500 s

It's not a huge difference, but it seems like a good start to tweak thread-loader further.

Dev rebuild tests--this is a lot less methodical, I just ran yarn start and saved the index.ts file a few times.

webpack version webpack-cli version devtool DLL? Parallelized? Range
5.88.0 4.8.0 eval-cheap-source-map No No 1500-1600 ms
5.97.1 5.1.4 eval No No 1100-1300 ms
5.97.1 5.1.4 eval Yes No 500-530 ms
5.97.1 5.1.4 eval Yes No 450-480 ms

The most significant impact is implementing DllPlugin for the lit dependency. Interestingly, enabling DllPlugin in the production build slowed it down.

Changes

  • Upgrades webpack and webpack tool versions
  • Updates dev source map to webpack recommendation
  • Implements webpack.DllPlugin in dev for faster rebuilds
  • Implements thread-loader to run ts-loader in a worker pool

etc

Generated locales might be a good candidate for DllPlugin, if we generated a file for each locale.

SuaYoo added 6 commits January 7, 2025 16:53

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Copy link

socket-security bot commented Jan 8, 2025

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@jsonjoy.com/base64@1.1.2 None 0 54.3 kB streamich
npm/@jsonjoy.com/json-pack@1.1.1 None +1 757 kB streamich
npm/@types/bonjour@3.5.13 None 0 5.57 kB types
npm/@types/connect-history-api-fallback@1.5.4 None 0 4.86 kB types
npm/@types/eslint-scope@3.7.7 None 0 6.27 kB types
npm/@types/node-forge@1.3.11 None 0 63.1 kB types
npm/@types/retry@0.12.2 None 0 7.91 kB types
npm/@types/send@0.17.4 None +1 13.6 kB types
npm/@types/serve-index@1.9.4 None 0 4.71 kB types
npm/@types/sockjs@0.3.36 None 0 5.35 kB types
npm/@webassemblyjs/ast@1.14.1 None 0 207 kB xtuc
npm/@webassemblyjs/floating-point-hex-parser@1.13.2 None 0 6.37 kB xtuc
npm/@webassemblyjs/helper-api-error@1.13.2 None 0 11.3 kB xtuc
npm/@webassemblyjs/helper-buffer@1.14.1 None 0 10.8 kB xtuc
npm/@webassemblyjs/helper-numbers@1.13.2 None 0 10.5 kB xtuc
npm/@webassemblyjs/helper-wasm-bytecode@1.13.2 None 0 34.2 kB xtuc
npm/@webassemblyjs/helper-wasm-section@1.14.1 None 0 19.7 kB xtuc
npm/@webassemblyjs/ieee754@1.13.2 None 0 5.34 kB xtuc
npm/@webassemblyjs/leb128@1.13.2 None 0 48.5 kB xtuc
npm/@webassemblyjs/utf8@1.13.2 None 0 12.3 kB xtuc
npm/@webassemblyjs/wasm-edit@1.14.1 None +1 172 kB xtuc
npm/@webassemblyjs/wasm-gen@1.14.1 None 0 28.1 kB xtuc
npm/@webassemblyjs/wasm-opt@1.14.1 None 0 14.4 kB xtuc
npm/@webassemblyjs/wast-printer@1.14.1 None 0 39.6 kB xtuc
npm/@webpack-cli/configtest@2.1.1 None 0 4.55 kB evilebottnawi
npm/@webpack-cli/info@2.0.2 None 0 3.72 kB evilebottnawi
npm/@webpack-cli/serve@2.0.5 environment 0 11.6 kB evilebottnawi
npm/body-parser@1.20.3 network +1 74.9 kB ulisesgascon
npm/bonjour-service@1.3.0 None 0 66.6 kB mdidon
npm/bundle-name@4.1.0 None 0 3.15 kB sindresorhus
npm/call-bind-apply-helpers@1.0.1 None 0 0 B
npm/call-bound@1.0.3 None +1 57.8 kB ljharb
npm/cookie@0.7.1 None 0 23.3 kB blakeembrey
npm/default-browser-id@5.0.0 None 0 3.02 kB sindresorhus
npm/default-browser@5.2.1 None 0 5.82 kB sindresorhus
npm/define-lazy-prop@3.0.0 None 0 4.42 kB sindresorhus
npm/dunder-proto@1.0.1 None 0 13 kB ljharb
npm/envinfo@7.14.0 environment, eval, filesystem, shell 0 162 kB tabrindle
npm/es-define-property@1.0.1 None 0 10.2 kB ljharb
npm/es-errors@1.3.0 None 0 12.3 kB ljharb
npm/es-object-atoms@1.0.0 None 0 9.17 kB ljharb
npm/express@4.21.2 environment, filesystem, network +4 266 kB jonchurch
npm/finalhandler@1.3.1 environment +1 23.3 kB wesleytodd
npm/flat@5.0.2 None 0 26.6 kB timoxley
npm/get-proto@1.0.1 None 0 10.8 kB ljharb
npm/hyperdyperid@1.2.0 None 0 861 kB streamich
npm/interpret@3.1.1 None 0 21.5 kB phated
npm/ipaddr.js@2.2.0 None 0 62.3 kB whitequark
npm/is-inside-container@1.0.0 None +1 6.63 kB sindresorhus
npm/is-network-error@1.1.0 None 0 4.54 kB sindresorhus
npm/json-parse-better-errors@1.0.2 None 0 6.7 kB zkat
npm/launch-editor@2.9.1 environment, filesystem, shell 0 17.1 kB soda
npm/math-intrinsics@1.1.0 None 0 17.3 kB ljharb
npm/merge-descriptors@1.0.3 None 0 5.08 kB sindresorhus

🚮 Removed packages: npm/@types/bonjour@3.5.10, npm/@types/connect-history-api-fallback@1.3.5, npm/@types/eslint-scope@3.7.4, npm/@types/retry@0.12.0, npm/@types/serve-index@1.9.1, npm/@types/sockjs@0.3.33, npm/@webassemblyjs/ast@1.11.6, npm/@webassemblyjs/floating-point-hex-parser@1.11.6, npm/@webassemblyjs/helper-api-error@1.11.6, npm/@webassemblyjs/helper-buffer@1.11.6, npm/@webassemblyjs/helper-numbers@1.11.6, npm/@webassemblyjs/helper-wasm-bytecode@1.11.6, npm/@webassemblyjs/helper-wasm-section@1.11.6, npm/@webassemblyjs/ieee754@1.11.6, npm/@webassemblyjs/leb128@1.11.6, npm/@webassemblyjs/utf8@1.11.6, npm/@webassemblyjs/wasm-edit@1.11.6, npm/@webassemblyjs/wasm-gen@1.11.6, npm/@webassemblyjs/wasm-opt@1.11.6, npm/@webassemblyjs/wast-printer@1.11.6, npm/@webpack-cli/configtest@1.2.0, npm/@webpack-cli/info@1.5.0, npm/@webpack-cli/serve@1.7.0, npm/acorn-import-assertions@1.9.0, npm/array-flatten@2.1.2, npm/body-parser@1.20.1, npm/bonjour-service@1.1.0, npm/cookie@0.5.0, npm/dns-equal@1.0.0, npm/envinfo@7.8.1, npm/express@4.18.2, npm/finalhandler@1.2.0, npm/html-entities@2.3.3, npm/http-proxy-middleware@2.0.6, npm/interpret@2.2.0, npm/ipaddr.js@2.0.1, npm/launch-editor@2.6.0, npm/merge-descriptors@1.0.1, npm/micromark-core-commonmark@2.0.0, npm/micromark-extension-gfm-strikethrough@2.0.0, npm/micromark-factory-destination@2.0.0, npm/micromark-factory-label@2.0.0, npm/micromark-factory-space@2.0.0, npm/micromark-factory-title@2.0.0, npm/micromark-factory-whitespace@2.0.0, npm/micromark-util-character@2.0.1, npm/micromark-util-chunked@2.0.0, npm/micromark-util-classify-character@2.0.0, npm/micromark-util-combine-extensions@2.0.0, npm/micromark-util-decode-numeric-character-reference@2.0.1, npm/micromark-util-encode@2.0.0, npm/micromark-util-html-tag-name@2.0.0, npm/micromark-util-normalize-identifier@2.0.0, npm/micromark-util-resolve-all@2.0.0, npm/micromark-util-sanitize-uri@2.0.0, npm/micromark-util-subtokenize@2.0.0, npm/micromark-util-symbol@2.0.0, npm/micromark-util-types@2.0.0

View full report↗︎

@SuaYoo SuaYoo marked this pull request as ready for review January 8, 2025 04:51
@SuaYoo SuaYoo requested review from emma-sg and ikreymer January 8, 2025 04:53
Copy link
Member

@emma-sg emma-sg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Yeah, without spending a while running perf tests this does seem to be a little faster.

@SuaYoo SuaYoo merged commit dd22fd1 into main Jan 14, 2025
5 checks passed
@SuaYoo SuaYoo deleted the frontend-webpack-build-perf branch January 14, 2025 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants