🧼 optimize install size#35
Conversation
commit: |
dreyfus92
left a comment
There was a problem hiding this comment.
overall looks really good. since you're optimizing install size, are you planning on the near future to add a "no size regression test", cause rn there's nothing in the CI that asserts the package stays under a certain size. without that the size could quietly creep back up over time.
Co-Authored-By: ghostdevv <ghostdevbusiness@gmail.com>
- replace sourceMap/declarationMap/target compiler options with skipSourceOutput: true - add type: "module" to package config - remove redundant files: ["esm"] (npm excludes lock files automatically, .npmignore handles the rest) Co-Authored-By: ghostdevv <ghostdevbusiness@gmail.com>
Co-Authored-By: ghostdevv <47755378+ghostdevv@users.noreply.github.com>
Co-Authored-By: ghostdevv <git@willow.sh>
|
There are a couple of optimizations here; some of which I'm 100% cool with, the others I think we need to make sure we do intentionally. Unalloyed Wins:
Needs consideration
|
Just so we don't block this work, can we merge all the other size optimizations and then consider these C options separately in the context of knowing how runtime perf is impacted? |
@cowboyd yep that sounds like the right path forward! happy to split those out with some benchmarks |
Reverts three changes that need benchmarks before landing: - -Oz / wasm-opt - brotli+Z85 wasm compression - wcwidth.c rewrite
* ✨ add snapshot() for pre-packing directive subtrees Introduces a new `snapshot(ops)` constructor that pre-packs a directive array into its transfer encoding. The returned opaque `Op` can be spliced into any directive array, and during packing its bytes are copied directly into the command buffer without re-encoding. This enables higher-level frameworks to implement dirty tracking: unchanged component subtrees can reuse a cached snapshot, skipping the per-frame packing cost entirely. * docs: add maintainer build guide * 💄 format build docs * 🐛 improve pack string overflow errors * os matrix test in ci (#36) * 🧼 optimize build * 🧼 compress bundled wasm * 🧼 optimize wcwidth.c size * ⚙️ update npm settings * 🐛 install wasm-opt in ci * ⚡ use brotli-11 + z85 wasm encoding * 📌 pin @types/node to v22 * 🧼 apply @ghostdevv review suggestions from PR #35 Co-Authored-By: ghostdevv <git@willow.sh> * 🔨 add type to bundle-wasm * 💌 signed, sealed, delivered * chore: use hashes for versions * chore: don't save git credentials * chore: use array syntax for some reason the schema for the actions wants it to be an array * perf: set concurrency limits to reduce cost and improve dx Without this it means that, for example, if I push a change to a PR then shortly push again this workflow will be running twice. This change will cancel the old run before starting the new one, which reduces the overall actions cost and DX as you don't have extra runs * chore: use hashes for versions * chore: update node version * perf: set concurrency limits to reduce cost and improve dx Without this it means that, for example, if I push a change to a PR then shortly push again this workflow will be running twice. This change will cancel the old run before starting the new one, which reduces the overall actions cost and DX as you don't have extra runs * chore: don't save git credentials * chore: mitigate potential template injection See https://docs.zizmor.sh/audits/#template-injection * chore: update ::set-output command to new syntax https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ * chore: use hashes for versions * chore: don't save git credentials * chore: limit id-token permission to the publishing steps * chore: explicitly disable npm cache to mitigate cache poisoning attacks * chore: mitigate potential template injection See https://docs.zizmor.sh/audits/#template-injection * chore: use oidc This should be using OIDC for publishing * chore: update ::set-output command to new syntax https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ * 🙅 revert aggressive optimization experiments pending benchmark Reverts three changes that need benchmarks before landing: - -Oz / wasm-opt - brotli+Z85 wasm compression - wcwidth.c rewrite * Add CodSpeed performance benchmarks * 🔨 use deno * 🧼 deno fmt * ⚙️ vitest -> tinybench * 🧼 remove codspeed assets * 🔨 fix ci * add type module * fmt * chore: update github url (#38) * downgrade to tinybench@5 * move to examples folder with readme * 🔧 export animating from wasm build * 🧪 cover transitions in snapshots and validation * ✅ enforce nonnegative transition duration --------- Co-authored-by: Charles Lowell <cowboyd@frontside.com> Co-authored-by: Jacob Bolda <me@jacobbolda.com> Co-authored-by: Nate Moore <nate@natemoo.re> Co-authored-by: ghostdevv <git@willow.sh> Co-authored-by: Nate Moore <git@natemoo.re> Co-authored-by: codspeed-hq[bot] <117304815+codspeed-hq[bot]@users.noreply.github.com> Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Reduces npm install size by 63% (723kB → 268kB unpacked) via:
src/duplication from the npm packageAlso bumps minimum node version to v22 (current LTS).
Future optimization opportunities identified (with unknown performance impact) include:
-02to-0z, addingwasm-optstepwcwidth