Skip to content

perf(http1): write during header sorting - #899

Merged
0x676e67 merged 4 commits into
mainfrom
perf
Aug 15, 2025
Merged

perf(http1): write during header sorting#899
0x676e67 merged 4 commits into
mainfrom
perf

Conversation

@0x676e67

Copy link
Copy Markdown
Owner

No description provided.

@0x676e67
0x676e67 marked this pull request as ready for review August 15, 2025 11:38
@0x676e67
0x676e67 requested a review from Copilot August 15, 2025 11:38

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 HTTP/1 header writing by eliminating intermediate header sorting and memory allocations. Instead of first sorting headers into a new HeaderMap and then iterating through them, the new approach directly writes headers during the sorting iteration process.

  • Introduces a new sort_headers_for_each method that combines sorting and iteration into a single operation
  • Replaces the write_headers_original_case function to use the new approach, removing the need for intermediate header storage
  • Refactors control flow in client response parsing for better readability

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/header.rs Adds sort_headers_for_each method and moves test helper function from public to test module
src/core/client/proto/h2/client.rs Updates variable naming for clarity (origorig_headers)
src/core/client/proto/h1/role.rs Refactors header writing to use new streaming approach and improves control flow structure

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

Comment thread src/core/client/proto/h1/role.rs Outdated
Comment thread src/header.rs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@0x676e67
0x676e67 merged commit f025e3f into main Aug 15, 2025
18 checks passed
@0x676e67
0x676e67 deleted the perf branch August 15, 2025 12:12
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.

2 participants