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

hostip: make create_hostcache_id avoid alloc + free #3544

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
3 participants
@bagder
Copy link
Member

commented Feb 9, 2019

The data is short-lived and will be copied anyway. By using a stack buffer and not doing a sprintf + lower case in two separate passes, this should speed this up quite a lot - although presumably not really noticeable...

In my test 8GB HTTP transfer from localhost, this patch reduces the total number of allocations needed from 87 to 83.

@danielgustafsson
Copy link
Member

left a comment

LGTM

@jay

This comment has been minimized.

Copy link
Member

commented Feb 9, 2019

I can't tap on the individual line in this browser but len-- is going to roll so len-1 is no good you could use 7 instead

@jay

This comment has been minimized.

Copy link
Member

commented Feb 9, 2019

erm assuming the colon like nix the *ptr++=':'; and then do it like 7, ":%u"

@bagder

This comment has been minimized.

Copy link
Member Author

commented Feb 9, 2019

Indeed, thanks!

@bagder bagder force-pushed the bagder/create-hostcache-on-stack branch from 099d57f to f7a3d04 Feb 9, 2019

@bagder bagder closed this in 81a9fe4 Feb 11, 2019

@bagder bagder deleted the bagder/create-hostcache-on-stack branch Feb 11, 2019

@lock lock bot locked as resolved and limited conversation to collaborators May 12, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.