Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

perf(urlencoded): move empty-body guard to avoid extra function closure - #647

#647
Merged
jonchurch merged 1 commit into
expressjs:masterexpressjs/body-parser:masterfrom
Phillip9587:urlencoded-remove-extra-closurePhillip9587/body-parser:urlencoded-remove-extra-closureCopy head branch name to clipboard
Jan 16, 2026
Merged

perf(urlencoded): move empty-body guard to avoid extra function closure#647
jonchurch merged 1 commit into
expressjs:masterexpressjs/body-parser:masterfrom
Phillip9587:urlencoded-remove-extra-closurePhillip9587/body-parser:urlencoded-remove-extra-closureCopy head branch name to clipboard

Conversation

@Phillip9587

Copy link
Copy Markdown
Member

Inlines the empty-body check into the parser returned by createQueryParser, removing the extra wrapper function. The behavior is unchanged but we get a minor perf/alloc win by not creating a extra closure.

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 optimizes the URL-encoded body parsing by eliminating an extra function closure and moving the empty-body check directly into the parser function. The change improves performance by removing an unnecessary wrapper function while maintaining identical behavior.

  • Moves empty-body guard from wrapper function to main parser function
  • Eliminates extra function closure creation
  • Changes var to const for the parser assignment

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread lib/types/urlencoded.js
@Phillip9587
Phillip9587 requested a review from a team October 27, 2025 20:20
@Phillip9587
Phillip9587 force-pushed the urlencoded-remove-extra-closure branch from aa99cd5 to 3694fbc Compare January 16, 2026 15:39
@jonchurch
jonchurch merged commit 8c36f57 into expressjs:master Jan 16, 2026
16 checks passed
@Phillip9587
Phillip9587 deleted the urlencoded-remove-extra-closure branch January 16, 2026 20:48
This was referenced Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.