GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — perf: keep the deserializer context's properties fast by hai-x · Pull Request #23526 · webpack/webpack

Conversation

@hai-x

@hai-x hai-x commented Nov 22, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Summary

The deserializer context carried rest as an own accessor, which drops the whole object out of V8's fast-properties representation, so every read and rest on it became a dictionary lookup with no inline cache — millions of them per hot build. Moving rest onto a prototype keeps the context fast without touching any of its ~400 call sites.

node --allow-natives-syntax -e 'const o={get x(){return 1}}; console.log(%HasFastProperties(o))' # Return false

What kind of change does this PR introduce?

perf

Did you add tests for your changes?

Existing

Does this PR introduce a breaking change?

No

If relevant, what needs to be documented once your changes are merged or what have you already documented?

n/a

Use of AI

Yes

Summary by CodeRabbit

  • Performance
    • Persistent-cache restoration is faster when reusing cached build data, helping reduce wait times during builds. This improvement is included in a patch release of webpack.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@changeset-bot

changeset-bot Bot commented Nov 22, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 595a086

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
webpack Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the area: cache Persistent and memory caching, serialization (lib/cache, lib/serialization) label Nov 22, 2026
@hai-x
perf(serialization): keep the deserializer context's properties fast
595a086
An own `rest` accessor dropped the context out of V8's fast-properties
representation, so every `read` and `rest` on a per-module hot path was a
dictionary lookup. A prototype getter keeps the object fast and inlines.
@hai-x
hai-x force-pushed the perf/deserializer-context-fast-properties branch from 03b2a5b to 595a086 Compare November 22, 2026 16:53
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

ObjectMiddleware now creates deserializer contexts from a base class with a prototype rest getter, then merges in the supplied context. A Changeset declares a webpack patch release and describes faster persistent-cache restoration.

Changes: Deserializer context construction

Layer / File(s) Summary
Define and use the deserializer context
lib/serialization/ObjectMiddleware.js, .changeset/486-faster-cache-restore.md
The base context stores read and setCircularReference, and its rest getter returns the context. Deserialization creates this base context and applies the supplied context with Object.assign. The Changeset declares a webpack patch release.

Possibly related PRs

  • webpack/webpack#23072: Uses the same deserializer rest contract in serializers and a test context.

Suggested labels: needs: tests, area: build-perf

Suggested reviewers: alexander-akait

Change: Refactor

Merge Risk: Minimal · up to 595a0

This is a performance-oriented refactor of how the deserializer context is built, and its behavior is unchanged for the contexts inspected. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "perf: keep the deserializer context's properties fast" uses the conventional-commit form with the allowed type "perf". It matches the change, which moves the deserializer context's rest get…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "perf: keep the deserializer context's properties fast" uses the conventional-commit form with the allowed type "perf". It matches the change, which moves the deserializer context's rest getter to a prototype getter so V8 keeps the context in fast-properties mode. The title does not show whether the branch prefix matches "perf", because no branch name was provided in the context.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

  • X
  • Mastodon
  • Reddit
  • LinkedIn
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: webpack/webpack
  • Branch: perf/deserializer-context-fast-properties
  • File: .coderabbit.yaml
  • Commit: 595a086
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 71c2d887-350c-4fd8-8680-550e84c088de
Commits

Reviewing files that changed from the base of the PR and between 651d9a5 and 595a086.

Files selected for processing: 2

  • .changeset/486-faster-cache-restore.md
  • lib/serialization/ObjectMiddleware.js

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Nov 22, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Reports for 595a086, computed by this pull request's own code. Each section updates when its workflow finishes.


Preview package

This PR is packaged and the instant preview of its latest commit is available.

Install it locally:

  • npm
npm i -D webpack@https://pkg.pr.new/webpack@23526
  • yarn
yarn add -D webpack@https://pkg.pr.new/webpack@23526
  • pnpm
pnpm add -D webpack@https://pkg.pr.new/webpack@23526

From Preview package run #13923.


Generated code size

Comparing base (651d9a5) to head (595a086). Merging this pull request will not change the code webpack generates.

What moved Tests Assets Gzip Raw Test edit
Changed, test untouched 0 0 — — —
Changed, test edited 0 0 — — —
New 0 0 — — —
Deleted 0 0 — — —
Unchanged — 10988 — — —

Read Changed, test untouched first: the test is byte-identical on both sides, so webpack generated the difference. Changed, test edited moved partly because the test did — Test edit is how many bytes the test gained, and a bundle that grew by less is not a regression. New and Deleted are whole files, not deltas — a new asset was created, not grown, so it reads gray (⚪ added) — and adding tests cannot bury a real change. Gzip decides, because that is what users download; raw is the tiebreak, and brotli and zstd are per asset below.

Sample apps

No sample app changed size.

26 unchanged app(s)
App Gzip Gzip change Raw Raw change
library amd 1.38 KiB — 2.68 KiB —
library amd-require 1.38 KiB — 2.67 KiB —
library assign 1.38 KiB — 2.66 KiB —
library assign-properties 1.42 KiB — 2.80 KiB —
library commonjs 1.38 KiB — 2.66 KiB —
library commonjs-module 1.38 KiB — 2.67 KiB —
library commonjs-static 1.55 KiB — 3.54 KiB —
library commonjs2 1.38 KiB — 2.67 KiB —
library global 1.38 KiB — 2.66 KiB —
library jsonp 1.37 KiB — 2.66 KiB —
library module 1.21 KiB — 2.35 KiB —
library self 1.38 KiB — 2.66 KiB —
library system 1.41 KiB — 2.73 KiB —
library this 1.37 KiB — 2.66 KiB —
library umd 1.44 KiB — 2.85 KiB —
library umd2 1.44 KiB — 2.85 KiB —
library var 1.38 KiB — 2.67 KiB —
library window 1.38 KiB — 2.66 KiB —
node-ssr 96.36 KiB — 371.26 KiB —
node-ssr-esm 96.60 KiB — 371.83 KiB —
react-100 32.14 KiB — 150.41 KiB —
react-1k 73.31 KiB — 907.23 KiB —
react-1k-esm 72.51 KiB — 906.05 KiB —
react-5k 191.45 KiB — 4.08 MiB —
webworker 36.60 KiB — 94.98 KiB —
webworker-esm 35.67 KiB — 93.65 KiB —

No asset changed size.

No runtime gained or lost a runtime module.

Built test/configCases with the defaults a user gets, and the apps in test/sizeCoreReports (apps/): 2518 test(s), 10988 asset(s), 112 emitted nothing.

From Generated code size run #8558.


Types Coverage

Typed lines: 99.66% (207426 of 208140)

Kind Base Head Change
any 41 41 —
unknown 18 18 —
object 13 13 —
Function 0 0 —
untyped 0 0 —

any counts EXPECTED_ANY, a written any and JSDoc's * and ? for any type. unknown counts a written unknown; ThrownValue, the unknown a throw or a rejected promise hands on, is left out. object counts EXPECTED_OBJECT and Object, Function counts EXPECTED_FUNCTION. Untyped counts the any TypeScript infers where no type is written: a type argument a call leaves to inference that comes out any, whether a lib signature defaults it, as in const map = new Map() and Array(5), or a generic call infers it from an any argument; and const list = []. An identifier that only holds an any written in the project's files is not counted again, as the any row counts it where it is written; an any a lib signature returns, such as JSON.parse's, is counted in neither row.

This pull request adds or removes no escape hatch, any or untyped identifier.

32 file(s) in lib/, hot/, declarations/ and bin/ still have an escape hatch, `any` or untyped identifiers
File Typed lines any unknown object Function untyped
declarations/WebpackOptions.ts 100.00% 7
lib/Compilation.js 99.97% 5 2
lib/module/NormalModule.js 100.00% 4 1
lib/loaders/LoaderOptionsPlugin.js 100.00% 4
lib/serialization/ObjectMiddleware.js 100.00% 4
lib/util/SortableSet.js 100.00% 4
lib/hmr/HotModuleReplacement.runtime.js 100.00% 2 1
lib/module/NormalModuleFactory.js 100.00% 3
lib/stats/StatsFactory.js 100.00% 2 1
lib/Compiler.js 99.88% 2
lib/config/defineConfig.js 100.00% 2
lib/hmr/JavascriptHotModuleReplacement.runtime.js 100.00% 2
lib/index.js 100.00% 2
lib/javascript/syntax-printer.js 99.99% 2
lib/loaders/LoaderRunner.js 100.00% 2
lib/module/Module.js 100.00% 2
lib/module/Parser.js 100.00% 2
lib/node/nodeConsole.js 100.00% 2
lib/config/cli.js 100.00% 1
lib/dll/DllReferencePlugin.js 100.00% 1
lib/graph/ModuleGraph.js 100.00% 1
lib/hmr/HotModuleReplacementPlugin.js 100.00% 1
lib/javascript/JavascriptParser.js 100.00% 1
lib/javascript/syntax-parser.js 100.00% 1
lib/logging/Logger.js 100.00% 1
lib/logging/createConsoleLogger.js 100.00% 1
lib/output/ManifestPlugin.js 100.00% 1
lib/serialization/types.js 100.00% 1
lib/stats/DefaultStatsFactoryPlugin.js 100.00% 1
lib/stats/StatsPrinter.js 100.00% 1
lib/util/makeSerializable.js 100.00% 1
lib/util/terminalColors.js 100.00% 1

From Types Coverage run #4581.


Module loading

How many files a fresh Node.js process loads (require or import) to do each thing below; a change from the pull request's base is marked 🔴 when it grew and 🟢 when it shrank. Every file is startup time, so fewer is better. webpack files are this package's own (lib/, hot/); node_modules files are its dependencies'.

What the process does webpack files node_modules files
require("webpack") 2 0
import "webpack" 2 0
JavaScript syntax 12 0
CSS syntax 12 0
HTML syntax 11 0
XML syntax 11 0
JavaScript minifier 13 0
CSS minifier 14 0
HTML minifier 19 0
XML minifier 14 0
JSON minifier 1 0
development build 422 103
production build 430 133
watch with HMR, one rebuild 446 110

From Module loading run #1825.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai coderabbitai Bot added area: build-perf Build time and memory of webpack itself needs: tests Fix or PR exists but lacks the required tests labels Nov 22, 2026
@codspeed

codspeed Bot commented Nov 22, 2026

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

2 warnings, 1 note

⚠️ 117 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ 2 benchmarks with a significant change ran on different hardware

Their base and head results were measured on machines with a different CPU, core count or memory, so the changes might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

ℹ️ 39 benchmarks have no flamegraph

The flamegraph wasn't generated: most of the time was spent in runtime internals, which would leave nothing useful to analyze.

See affected benchmarks

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 349 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Memory benchmark "no-minimize", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 172.1 KB 256.7 KB -32.96%
⚡ Memory benchmark "devtool-eval-source-map", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 8,126.2 KB 257.8 KB ×32

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing perf/deserializer-context-fast-properties (595a086) with main (651d9a5)

Open in CodSpeed
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait
alexander-akait merged commit c1cf905 into main Nov 22, 2026
54 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait
alexander-akait deleted the perf/deserializer-context-fast-properties branch November 22, 2026 18:50
@github-actions github-actions Bot mentioned this pull request Nov 22, 2026
chore(release): new release #23490
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

area: build-perf Build time and memory of webpack itself area: cache Persistent and memory caching, serialization (lib/cache, lib/serialization) needs: tests Fix or PR exists but lacks the required tests

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@hai-x @alexander-akait
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.