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 allocating a String to parse SocketAddr #2109

Merged

Conversation

jvff
Copy link
Contributor

@jvff jvff commented Jun 6, 2024

Motivation

I ran into another instance of a String allocation just to parse a SocketAddr. Some of these cases were removed in previous PRs (#2088, #2093).

Proposal

Parse only the IpAddr instead, reusing the port value. This avoids an allocation and parsing of the port value.

Test Plan

This is an internal refactor. Existing tests should catch any regressions.

Release Plan

This is an internal refactor, so nothing is needed.

Links

@jvff jvff added the refactor label Jun 6, 2024
@jvff jvff added this to the Testnet milestone Jun 6, 2024
@jvff jvff requested review from Twey, ma2bd, ndr-ds, afck and christos-h June 6, 2024 14:34
@jvff jvff self-assigned this Jun 6, 2024
Pass a host-port tuple forward, so that only the host `IpAddr` needs to
be parsed.
@jvff jvff force-pushed the dont-allocate-string-to-parse-socket-addr branch from 75e5b62 to 845120d Compare June 6, 2024 15:28
@jvff jvff merged commit 5bddb1f into linera-io:main Jun 6, 2024
3 checks passed
@jvff jvff deleted the dont-allocate-string-to-parse-socket-addr branch June 6, 2024 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

2 participants