Skip to content

Reduction of memory allocations for hw_address_to_string #299

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

Merged
merged 1 commit into from
May 31, 2018
Merged

Reduction of memory allocations for hw_address_to_string #299

merged 1 commit into from
May 31, 2018

Conversation

thrimbor
Copy link
Contributor

During my usage of a profiler to optimize a program using libtins to analyze a pcap file and collect statistics, I noticed many temporary allocations for a string stream and traced it to hw_address_to_string.
I rewrote it to use a string instead, which results in only a single allocation per function call. The code isn't very pretty, but it did have a noticeable effect on the performance of my program.

I also removed storage_to_string since hw_address_to_string was its only user.

@mfontanini
Copy link
Owner

Nice, thanks!

@mfontanini mfontanini merged commit 3659d89 into mfontanini:master May 31, 2018
@thrimbor thrimbor deleted the hw_address_to_string-optimization branch June 5, 2018 17:36
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