webpack
tapable
Blog
Docs
Changelog
Blog
Docs
Changelog
Overview
Branches
Benchmarks
Runs
Performance History
Latest Results
fix: preserve custom tap options dropped by _tap fast path (#227)
main
7 hours ago
perf(Hook): replace Object.keys with for-in in only-name guard The previous fix used `Object.keys(options).length === 1` to check whether the tap options object carries any properties beyond `name` before taking the fast-path literal construction. `Object.keys` allocates an intermediate array on every call, costing ~10% on the common `hook.tap({ name: "X" }, fn)` shape vs the (broken) baseline. Swapping to a `for...in` scan with an early-break avoids that allocation and pulls the regression down to within measurement noise (~3%), while keeping the correctness property - any extra user- supplied key (e.g. webpack's `additionalAssets`) forces the safe `Object.assign` slow path. Benchmarked locally with tinybench, 10 taps per iteration, mean of three runs: shape broken for-in delta string 2.66M 2.50M -6% {name} 2.16M 2.10M -3% {name,stage} 1.01M 0.98M -3% {name,additionalAssets} 2.19M 1.15M -48% * {name,before} 511K 491K -4% * inherent: this shape must now take the correct slow path since the previous "fast" speed was produced by dropping the property.
claude/fix-additional-assets-test-IdN0k
7 hours ago
chore: test refactor + change changelog entry (#226)
main
17 hours ago
chore: test refactor + change changelog entry
refactor-tests
18 hours ago
fix(perf): more perf
main
18 hours ago
Revert "fix(perf): drop more per-compile and per-insert allocations" This reverts commit 4355011c88e5f5d355fe02103626eb41cf47f7fc.
claude/test-perf-improvements-JXkUd
18 hours ago
fix(perf): split _insert walk so stage-only path has no overhead The previous commit added a single-string `before` fast path to _insert but routed the stage-only path (no `before`, hit by `tap({stage})` insertions like the `with stages` bench) through the same loop, which then had to do `beforeName !== undefined` and `before !== undefined` checks on every iteration. That showed as a regression on CodSpeed instruction counts. Fork the walk into two variants: - No `before`: pure stage walk with zero extra branches - matches pre-fast-path instruction count on that path. - Has `before`: keeps the beforeName / Set logic. Also drop the `before: ["x"]` -> beforeName coercion. Single-element `before` arrays are rare; removing the special case simplifies the setup block and the generated hidden class. All 126 jest tests and 88 snapshots still pass, lint clean. https://claude.ai/code/session_01863WjdJD1wESVQcdrqgoJL
claude/test-perf-improvements-JXkUd
19 hours ago
fix(perf): drop more per-compile and per-insert allocations Three independent allocation reductions: - HookCodeFactory.setup(): swap `Array.from({length})` for `new Array(length)`. The former walks the array-like protocol and writes `undefined` into every slot before the loop immediately overwrites it; the latter just reserves the backing store. - HookCodeFactory.contentWithInterceptors(): assign directly to `options.onError`/`onResult`/`onDone` instead of `Object.assign(options, {…})`. Avoids allocating the RHS literal (which is thrown away after the merge) on every compile that has interceptors. - Hook._insert(): fast path for single-name `before`. When `item.before` is `"name"` (or `["name"]`) we now hold the name in a string and do `tap.name === beforeName` instead of building a Set just to call `.has()` once per walk step. The existing Set path is kept for multi-name before. Behavior unchanged: all 126 jest tests and 88 snapshots still pass, generated code is byte-identical. https://claude.ai/code/session_01863WjdJD1wESVQcdrqgoJL
claude/test-perf-improvements-JXkUd
19 hours ago
Latest Branches
CodSpeed Performance Gauge
0%
fix: preserve custom tap options dropped by _tap fast path
#227
7 hours ago
4622404
claude/fix-additional-assets-test-IdN0k
CodSpeed Performance Gauge
0%
chore: test refactor + change changelog entry
#226
18 hours ago
8a3f5d7
refactor-tests
CodSpeed Performance Gauge
0%
fix(perf): cache lengths/locals in more hot loops
#225
18 hours ago
1729bb4
claude/test-perf-improvements-JXkUd
© 2026 CodSpeed Technology
Home
Terms
Privacy
Docs