Avatar for the webpack user
webpack
webpack-sources
BlogDocsChangelog

Performance History

Latest Results

feat: add parsedMap option, post-minifier benchmark, getCachedData test Addresses the polish items from the second review of PR #221: - **#2 post-minifier asset shape benchmark.** New Scenario 3 in `benchmark/memory/clear-cache.mjs` constructs the shape webpack assets actually present at the PROCESS_ASSETS_STAGE_DEV_TOOLING hook: a `CachedSource` wrapping a `SourceMapSource` whose `_cachedSource` (bundle string) and `_cachedMaps[{}]` (composed map) are populated. 50 chunks: 8.5 MB baseline → 0 MB after `clearCache({ maps: true, source: false, recursive: false })`. - **#3 optional `parsedMap: true` flag** on `ClearCacheOptions`. When set, `SourceMapSource.clearCache` drops the parsed object forms of `_sourceMapAsObject` and `_innerSourceMapAsObject` (heaviest cached representation), but only when a serialized form (buffer or string) is also held so data stays recoverable. Defaults to `false` to preserve the cheap toString re-hydration path described in the comment. - **#4 `getCachedData()` after `clearCache()` interaction test.** Pins the observable shape: buffer + source = undefined, maps empty, hash + size preserved when their flags default to false. Round-trips through `new CachedSource(source, data)` to confirm cleared cached data is still a valid input. - **#5 "release hint" framing** in the `Source.prototype.clearCache` JSDoc. Opens with "clearCache is a memory hint: it never affects correctness or output, only how expensive the next read is." - **#6 dedup correctness test** already lives at `test/clearCache.js:251` ("a shared subtree is walked once when a `visited` WeakSet is passed") with a negative control at :269. Tests grow to 25 (was 22). Full suite 89,870/89,870 pass, lint clean. Benchmark numbers unchanged on Scenarios 1 + 2: 44.7% heap reduction on unique tasks, 3.6× dedup speedup, 228× `recursive: false` speedup. https://claude.ai/code/session_01LLtSGKaynui1P1wQsfVnXx
claude/fix-webpack-issue-0KinR
1 day ago
feat: deduplicate clearCache recursion and add granular options Review of PR #221 flagged three blocking issues for webpack's SourceMapDevToolPlugin use case: 1. **Recursion had no de-duplication.** When a webpack plugin iterates assets, the same module-level CachedSource is reachable from many chunks, so calling `clearCache()` per asset re-walked the shared subtree once per chunk. The reviewer's 50-chunk benchmark went from 10s to 17–45s with no extra heap freed. 2. **Recursion was non-opt-outable.** Webpack often replaces the asset shortly after calling `clearCache()`, so walking the children ourselves is pure waste — V8 reclaims them for free anyway. 3. **Cheap-to-hold caches were cleared unconditionally.** `_cachedSize` is a single number; `_cachedHashUpdate` is what makes downstream `cache.store` cheap. Dropping them on a generic "release memory" call is a perf cliff. The new signature addresses all three: ```js clearCache( { maps = true, source = true, hash = false, size = false, recursive = true } = {}, visited ) ``` - A `visited` `WeakSet` lets callers iterate assets in a loop and walk each shared subtree at most once. Internally, every node also adds itself to `visited` on first visit so further parents short-circuit. - `recursive: false` makes the call O(1) per asset for the common case where the asset is about to be GC'd anyway. - `hash` and `size` default to `false` (kept) — they're cheap to hold and expensive to rebuild. - `_cachedMaps.clear()` replaces `new Map()` to avoid per-call allocation churn. Updated benchmark (`benchmark/memory/clear-cache.mjs`) adds a shared-modules scenario mirroring the reviewer's webpack shape. On 50 chunks × 1000 shared modules: - naive `clearCache()` 12.7 ms - `clearCache(opts, visited)` 4.4 ms (2.9× speedup) - `clearCache({ recursive: false })` 0.1 ms (188× speedup) `CompatSource.clearCache` now forwards `visited` through to wrapped SourceLike implementations so dedup is preserved across CompatSource boundaries. Public `Source.prototype.clearCache` JSDoc documents the concurrency contract and that subsequent reader calls may repopulate caches. Tests grow to 22 (was 14) — covers dedup, the granular options, the opt-out recursion, and that `_cachedMaps` is reused not reallocated. https://claude.ai/code/session_01LLtSGKaynui1P1wQsfVnXx
claude/fix-webpack-issue-0KinR
1 day ago
chore(deps): bump the dependencies group with 2 updates (#220) Bumps the dependencies group with 2 updates: [actions/create-github-app-token](https://github.com/actions/create-github-app-token) and [changesets/action](https://github.com/changesets/action). Updates `actions/create-github-app-token` from 3.1.1 to 3.2.0 - [Release notes](https://github.com/actions/create-github-app-token/releases) - [Changelog](https://github.com/actions/create-github-app-token/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/create-github-app-token/compare/1b10c78c7865c340bc4f6099eb2f838309f1e8c3...bcd2ba49218906704ab6c1aa796996da409d3eb1) Updates `changesets/action` from 1.7.0 to 1.8.0 - [Release notes](https://github.com/changesets/action/releases) - [Changelog](https://github.com/changesets/action/blob/main/CHANGELOG.md) - [Commits](https://github.com/changesets/action/compare/6a0a831ff30acef54f2c6aa1cbbc1096b066edaf...63a615b9cd06ba9a3e6d13796c7fbcb080a60a0b) --- updated-dependencies: - dependency-name: actions/create-github-app-token dependency-version: 3.2.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: changesets/action dependency-version: 1.8.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
main
3 days ago

Latest Branches

CodSpeed Performance Gauge
0%
feat: add Source.prototype.clearCache() to release per-instance caches#221
1 day ago
adbb4f8
claude/fix-webpack-issue-0KinR
CodSpeed Performance Gauge
0%
chore(deps): bump the dependencies group with 2 updates#220
3 days ago
55c9587
dependabot/github_actions/dependencies-f42450c4f3
CodSpeed Performance Gauge
0%
7 days ago
dfa1c12
dependabot/npm_and_yarn/fast-uri-3.1.2
© 2026 CodSpeed Technology
Home Terms Privacy Docs