Skip to content

perf: reduce asset reporting and broadcast overhead - #5729

Open
OskarEichler wants to merge 3 commits into
webpack:mainfrom
OskarEichler:codex/server-reporting-overhead
Open

perf: reduce asset reporting and broadcast overhead#5729
OskarEichler wants to merge 3 commits into
webpack:mainfrom
OskarEichler:codex/server-reporting-overhead

Conversation

@OskarEichler

@OskarEichler OskarEichler commented Aug 28, 2026

Copy link
Copy Markdown

Improvements

  • Request only children/assets/publicPath statistics for the asset report instead of collecting the entire compilation.
  • Create serve-index middleware once per configured mount, not once per directory request.
  • Serialize a broadcast payload once, lazily on the first open client, instead of once per client.

Compatibility

No API, dependency, engine or intended output change. Empty/closed-only client sets still do no serialization. Asset order, compiler names and single/multi-compiler handling are retained.

Verification

Real webpack compilation with 31 emitted assets confirms complete report output and narrow stats options. Controls cover directory GET/HEAD and non-GET delegation, single/multiple/closed clients and serialization counts. Combined middleware/reporting/startup controls: 15 pass. Existing report, middleware and client/server tests pass in the frozen full run. Build and lint/type checks pass. No unsupported wall-clock speedup claim.

Audit scope

This is a focused, independently based change from a broader source review at f804962. The combined frozen-source run executed 1,002 tests: 951 passed, 43 failed, one cancelled, seven skipped. Failures were traced to the separately proposed overlay DOM snapshots, reconnect-disabled test expectation and IPv6 host-test assumptions; it is not represented as a green full suite. Relevant focused results are listed above. No checked-in tests/specs/snapshots were added or modified. Hosted CI and the full OS/Node matrix remain pending.

Summary by CodeRabbit

  • Performance Improvements
    • Reduced overhead when generating asset reports by collecting only the required statistics.
    • Improved directory listings by reusing the listing middleware.
    • Reduced WebSocket messaging overhead by serializing each broadcast once before sending it to connected clients.

@changeset-bot

changeset-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fc2f579

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

This PR includes changesets to release 1 package
Name Type
webpack-dev-server 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

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 27de1080-4357-479d-8061-8d24d3edafca

📥 Commits

Reviewing files that changed from the base of the PR and between 409e84b and fc2f579.

📒 Files selected for processing (2)
  • lib/Server.js
  • test/e2e/built-in-routes.test.js

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


Walkthrough

The assets-report middleware calls stats.toJson() once with selected fields. It requests child statistics only for multi-compiler output. The directory-listing middleware is created once and reused. sendMessage serializes each payload once for all open clients. A changeset records a patch release for webpack-dev-server.

Merge Risk: ⚪ Minimal · up to fc2f5

The performance changes preserve asset ordering, compiler handling, request method behavior, and broadcast semantics while reducing repeated work. Focused and existing tests pass, with no API or deployment change, so no actionable merge-blocking risk remains beyond normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main performance improvements: reduced asset-reporting and WebSocket broadcast overhead.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 027f3a94-8e91-49f9-90f1-e47fa0af7f48

📥 Commits

Reviewing files that changed from the base of the PR and between f804962 and 409e84b.

📒 Files selected for processing (2)
  • .changeset/server-reporting-overhead.md
  • lib/Server.js

Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.

Comment thread lib/Server.js Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant