Zero-Copy Body Conversion and Performance Benchmarks#627
Merged
Conversation
- Replace body.to_vec() with match expression that moves ownership of underlying data instead of copying - Body::Text uses into_bytes() to consume the String - Body::Binary moves the Vec directly - Add fallback for future non-exhaustive Body variants - Add with_binary_body() to LambdaEventBuilder for proper binary body testing with base64 encoding - Add test_http_request_body_forwarded integration test covering all three Body variants (Empty, Text, Binary)
- Add e2e_body_forwarding benchmark testing text and binary bodies from 0 to 6MB (Lambda payload limit) - Add GitHub Actions workflow to run benchmarks on PRs and detect regressions >10% - Add criterion and critcmp for benchmark comparison - Benchmark uses httpmock for realistic HTTP round-trip testing - Binary body sizes account for base64 encoding overhead
Contributor
Author
|
The benchmark workflow failed because the main branch does not have the benchmark code until this PR is merged. |
vicheey
approved these changes
Jan 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR optimizes the body forwarding path in the Lambda Web Adapter by eliminating unnecessary memory copies, and adds comprehensive benchmarks with CI integration to prevent performance regressions.
Description of changes:
Zero-Copy Body Conversion
Replaced body.to_vec() in fetch_response() with a match expression that moves ownership instead of copying:
Performance Benchmarks
CI Workflow
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.