Conversation
godlygeek
force-pushed
the
source_buffering
branch
from
September 2, 2026 05:02
67cc8f8 to
31e1462
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1016 +/- ##
==========================================
+ Coverage 92.42% 92.48% +0.05%
==========================================
Files 102 102
Lines 13303 13312 +9
Branches 482 482
==========================================
+ Hits 12295 12311 +16
+ Misses 1008 1001 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Read data from the capture file in large chunks, and then reference that buffered data during record parsing, refilling it as necessary. This significantly reduces the number of virtual method calls that are needed and significantly increases branch predictability and performance. Signed-off-by: Matt Wozniski <godlygeek@gmail.com>
godlygeek
force-pushed
the
source_buffering
branch
from
September 2, 2026 05:25
31e1462 to
7fb1ca7
Compare
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.
#1011 accidentally targeted the
faster-capture-padding-scanbranch, rather thanmain.While fixing that, I got nerd sniped into playing around, since I wasn't totally happy with how #1011 was factored, and came up with something that I think is organized better and which is actually faster as well.
This PR removes the buffering that was happening inside the
SocketSourcein favor of a newBufferedSourceclass, which wraps an existingSourceand adds buffering. TheRecordReaderonly ever reads via aBufferedSource, and theBufferedSourceisn't a subclass of theSourceabstract base class, so the calls made byRecordReaderin its hot loop don't need to go through virtual dispatch. We only need to hop through a vtable when we need to refresh the buffer, which is once per 64KiB read for theFileSource, though more often for theSocketSourcesince we don't expect the socket to have 64KiB sitting in it waiting for us every time we request more data.