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
Optimize PrefixString()
#23201
Optimize PrefixString()
#23201
Conversation
/test |
Jenkins tests all passed, CI.0 had some trouble due to images failing to build. |
This comment was marked as outdated.
This comment was marked as outdated.
d8c5abc
to
c7b6193
Compare
This comment was marked as outdated.
This comment was marked as outdated.
c7b6193
to
9ab5c1e
Compare
8b04441
to
1fe9a01
Compare
/test |
Runtime test hit #23272. |
/test-runtime |
@aditighag ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
1fe9a01
to
8796a51
Compare
/test |
8796a51
to
5f4daae
Compare
/test Edit: 4.19 hit #23845. |
/test-1.16-4.19 |
Add unit test coverage to (*IPIdentityPair).PrefixString(). Signed-off-by: David Schlosnagle <davids@palantir.com>
This will allow us to establish a baseline when evaluating optimizations to this function. Signed-off-by: Chris Tarazi <chris@isovalent.com>
Remove the use of fmt.Sprintf() which is known to be inefficient and simplify the function by reducing allocations and computations generating prefix string. Results: ``` $ go test -v ./pkg/identity -run '^$' -count 10 -bench BenchmarkIPIdentityPair_PrefixString -benchmem > old.txt $ go test -v ./pkg/identity -run '^$' -count 10 -bench BenchmarkIPIdentityPair_PrefixString -benchmem > new.txt $ benchstat old.txt new.txt name old time/op new time/op delta IPIdentityPair_PrefixString/host-16 438ns ± 6% 126ns ± 6% -71.12% (p=0.000 n=10+10) IPIdentityPair_PrefixString/not_host-16 248ns ± 8% 61ns ± 3% -75.55% (p=0.000 n=10+9) name old alloc/op new alloc/op delta IPIdentityPair_PrefixString/host-16 64.0B ± 0% 32.0B ± 0% -50.00% (p=0.000 n=10+10) IPIdentityPair_PrefixString/not_host-16 48.0B ± 0% 16.0B ± 0% -66.67% (p=0.000 n=10+10) name old allocs/op new allocs/op delta IPIdentityPair_PrefixString/host-16 5.00 ± 0% 2.00 ± 0% -60.00% (p=0.000 n=10+10) IPIdentityPair_PrefixString/not_host-16 3.00 ± 0% 1.00 ± 0% -66.67% (p=0.000 n=10+10) ``` Co-authored-by: David Schlosnagle <davids@palantir.com> Signed-off-by: David Schlosnagle <davids@palantir.com> Signed-off-by: Chris Tarazi <chris@isovalent.com>
5f4daae
to
b35fbb3
Compare
/test |
Marking ready to merge given that CI has passed (ingress tests have been replaced so no need to run them, see #24025) and we have approving reviews. |
Co-contributed by @schlosna.
Main commit pasted here for ease of viewing:
Related: #19571