feat(benchmark): add TCP receive dispatch benchmark (std::span vs std::vector)#325
Merged
Conversation
…::vector) Add focused benchmarks to quantify overhead difference between span-based and vector-based receive dispatch paths. Benchmarks included: - BM_TcpReceive_Dispatch_Span: zero-allocation span-based dispatch - BM_TcpReceive_Dispatch_VectorFallback: per-iteration vector allocation - BM_TcpReceive_Dispatch_Span_MultiCallback: multi-handler span sharing - BM_TcpReceive_Dispatch_Vector_MultiCallback: multi-handler with copies - BM_TcpReceive_Subspan_Operations: efficient protocol header/payload parsing - BM_TcpReceive_VectorSlice_Operations: legacy vector slicing overhead Results show span path is ~10-46x faster than vector fallback depending on payload size. Closes #320
Update README.md and README_KO.md to include: - TCP receive dispatch benchmark in overview - Filter command for TcpReceive benchmarks - Detailed benchmark category section with target metrics
Contributor
Performance ComparisonBase Branch ResultsNo base results PR Branch ResultsNo PR results |
5 tasks
kcenon
added a commit
that referenced
this pull request
Apr 13, 2026
…::vector) (#325) * feat(benchmark): add TCP receive dispatch benchmark (std::span vs std::vector) Add focused benchmarks to quantify overhead difference between span-based and vector-based receive dispatch paths. Benchmarks included: - BM_TcpReceive_Dispatch_Span: zero-allocation span-based dispatch - BM_TcpReceive_Dispatch_VectorFallback: per-iteration vector allocation - BM_TcpReceive_Dispatch_Span_MultiCallback: multi-handler span sharing - BM_TcpReceive_Dispatch_Vector_MultiCallback: multi-handler with copies - BM_TcpReceive_Subspan_Operations: efficient protocol header/payload parsing - BM_TcpReceive_VectorSlice_Operations: legacy vector slicing overhead Results show span path is ~10-46x faster than vector fallback depending on payload size. Closes #320 * docs(benchmark): add TCP receive dispatch benchmark documentation Update README.md and README_KO.md to include: - TCP receive dispatch benchmark in overview - Filter command for TcpReceive benchmarks - Detailed benchmark category section with target metrics
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.
Summary
Benchmarks Added
BM_TcpReceive_Dispatch_SpanBM_TcpReceive_Dispatch_VectorFallbackBM_TcpReceive_Dispatch_Span_MultiCallbackBM_TcpReceive_Dispatch_Vector_MultiCallbackBM_TcpReceive_Subspan_OperationsBM_TcpReceive_VectorSlice_OperationsLocal Benchmark Results
Results show span path is 10-46x faster than vector fallback:
Test plan
-DNETWORK_BUILD_BENCHMARKS=ONcmake -B build -S . -DNETWORK_BUILD_BENCHMARKS=ON -DCMAKE_BUILD_TYPE=Release cmake --build build --target network_benchmarks ./build/benchmarks/network_benchmarks --benchmark_filter=TcpReceiveCloses #320