Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid calling safe_realloc unnecessarily from ODesc::Grow() #2244

Merged
merged 1 commit into from Jul 8, 2022

Conversation

timwoj
Copy link
Contributor

@timwoj timwoj commented Jul 7, 2022

This is a silly bug in ODesc::Grow(), where we call safe_realloc even if the buffer size doesn't change. This theoretically shouldn't cause a realloc, but on some extremely pathological cases I've seen significant performance improvements by avoiding calling it (think ~50x reductions in time spent).

On more normal-looking traffic, it's looking like up to 2% improvement in CPU used (tcpreplay of data-center-like traffic at 500mbps for 5 minutes) and up to 2.5% improvement in pcap read times (pcap file with a very large number of http sessions).

@vpax
Copy link
Contributor

vpax commented Jul 7, 2022

O + M + G.

@timwoj timwoj force-pushed the topic/timw/avoid-extra-reallocs branch from 0112c86 to c912771 Compare July 8, 2022 16:55
@timwoj timwoj merged commit 0728676 into master Jul 8, 2022
@timwoj timwoj deleted the topic/timw/avoid-extra-reallocs branch July 8, 2022 16:55
@timwoj timwoj mentioned this pull request Jul 13, 2022
5 tasks
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.

None yet

3 participants