Skip to content

perf: inline content stream setup#750

Open
Phillip9587 wants to merge 1 commit into
expressjs:masterfrom
Phillip9587:perf-inline-content-stream
Open

perf: inline content stream setup#750
Phillip9587 wants to merge 1 commit into
expressjs:masterfrom
Phillip9587:perf-inline-content-stream

Conversation

@Phillip9587

Copy link
Copy Markdown
Member

Inline content stream initialization into read to keep the stream and content-length state local. Only read content-length when needed and avoid temporary mutations of req.length and stream.length.

Inline content stream initialization into `read` to keep the stream and content-length state local. Only read `content-length` when needed and avoid temporary mutations of `req.length` and `stream.length`.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors request body reading in lib/read.js by inlining the content stream initialization into read, keeping stream and content-length handling local and avoiding temporary mutation of req.length / stream.length.

Changes:

  • Inline content-encoding detection and inflate gating directly into read.
  • Only read content-length when content-encoding is identity and use req directly as the stream.
  • Remove the now-unnecessary private contentstream helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bjohansebas bjohansebas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How much of a performance improvement does this provide?

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.

3 participants