This repository has been archived by the owner on May 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
shrink IPPrefix using intern.Value to handle zones and bits #175
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
An experiment for #167. I'd probably a failed experiment. name old time/op new time/op delta IPSetFuzz-8 7.54µs ± 1% 7.61µs ± 1% +0.87% (p=0.004 n=10+10) BinaryMarshalRoundTrip/ipv4-8 13.8ns ± 1% 14.0ns ± 1% +1.12% (p=0.000 n=10+10) BinaryMarshalRoundTrip/ipv6-8 22.9ns ± 2% 23.1ns ± 1% ~ (p=0.060 n=10+10) BinaryMarshalRoundTrip/ipv6+zone-8 106ns ± 4% 106ns ± 0% ~ (p=0.306 n=9+9) StdIPv4-8 91.6ns ± 2% 91.8ns ± 1% ~ (p=0.182 n=9+10) IPv4-8 85.0ns ± 1% 83.9ns ± 0% -1.35% (p=0.000 n=8+10) IPv4_inline-8 88.7ns ± 2% 88.4ns ± 2% ~ (p=0.497 n=10+9) StdIPv6-8 117ns ± 1% 117ns ± 0% ~ (p=0.304 n=10+10) IPv6-8 108ns ± 1% 108ns ± 1% ~ (p=0.223 n=10+10) IPv4Contains-8 3.15ns ± 1% 11.95ns ± 1% +279.39% (p=0.000 n=10+10) IPv6Contains-8 3.82ns ± 3% 13.03ns ± 2% +241.22% (p=0.000 n=9+10) ParseIP/v4-8 14.0ns ± 1% 13.9ns ± 1% -0.64% (p=0.036 n=10+10) ParseIP/v6-8 69.1ns ± 3% 67.9ns ± 0% -1.75% (p=0.000 n=9+10) ParseIP/v6_ellipsis-8 43.7ns ± 2% 43.6ns ± 2% ~ (p=0.796 n=10+10) ParseIP/v6_v4-8 43.5ns ± 2% 43.4ns ± 2% ~ (p=0.549 n=9+10) ParseIP/v6_zone-8 85.3ns ± 3% 87.5ns ± 4% +2.59% (p=0.033 n=10+9) StdParseIP/v4-8 35.8ns ± 2% 35.8ns ± 1% ~ (p=0.715 n=9+9) StdParseIP/v6-8 82.2ns ± 0% 83.1ns ± 0% +1.02% (p=0.000 n=8+9) StdParseIP/v6_ellipsis-8 53.2ns ± 2% 53.9ns ± 1% +1.29% (p=0.001 n=10+10) StdParseIP/v6_v4-8 75.6ns ± 1% 76.1ns ± 0% +0.73% (p=0.000 n=9+10) StdParseIP/v6_zone-8 64.4ns ± 1% 65.3ns ± 1% +1.43% (p=0.000 n=10+10) IPString/v4-8 22.6ns ± 1% 22.6ns ± 1% ~ (p=0.482 n=9+10) IPString/v6-8 62.2ns ± 0% 62.8ns ± 1% +0.95% (p=0.001 n=10+10) IPString/v6_ellipsis-8 57.1ns ± 0% 57.6ns ± 1% +0.85% (p=0.000 n=9+10) IPString/v6_v4-8 58.7ns ± 1% 59.3ns ± 0% +1.07% (p=0.000 n=10+9) IPString/v6_zone-8 58.5ns ± 0% 59.0ns ± 1% +0.90% (p=0.000 n=10+10) IPMarshalText-8 21.3ns ± 1% 21.5ns ± 1% +0.79% (p=0.000 n=10+10) IPPortString/v4-8 159ns ± 0% 160ns ± 1% +1.00% (p=0.000 n=9+10) IPPortString/v6-8 123ns ± 1% 124ns ± 1% ~ (p=0.147 n=9+10) IPPortString/v6_ellipsis-8 119ns ± 1% 120ns ± 0% +0.70% (p=0.004 n=9+10) IPPortString/v6_v4-8 119ns ± 1% 120ns ± 1% +1.07% (p=0.000 n=10+9) IPPortString/v6_zone-8 121ns ± 1% 122ns ± 1% +0.61% (p=0.024 n=10+10) IPPortMarshalText/v4-8 36.7ns ± 1% 36.8ns ± 1% ~ (p=0.484 n=10+9) IPPortMarshalText/v6-8 74.2ns ± 1% 74.9ns ± 1% +0.92% (p=0.003 n=9+10) IPPortMarshalText/v6_ellipsis-8 71.7ns ± 1% 72.3ns ± 1% +0.89% (p=0.000 n=9+10) IPPortMarshalText/v6_v4-8 73.9ns ± 1% 74.6ns ± 1% +0.91% (p=0.000 n=10+10) IPPortMarshalText/v6_zone-8 73.1ns ± 1% 73.7ns ± 0% +0.78% (p=0.001 n=10+9) IPPrefixMasking/IPv4_/32-8 4.01ns ± 5% 6.25ns ± 1% +55.99% (p=0.000 n=10+8) IPPrefixMasking/IPv4_/17-8 3.94ns ± 0% 6.23ns ± 0% +58.03% (p=0.000 n=10+10) IPPrefixMasking/IPv4_/0-8 3.95ns ± 0% 6.23ns ± 0% +57.81% (p=0.000 n=8+10) IPPrefixMasking/IPv6_/128-8 3.94ns ± 1% 6.25ns ± 0% +58.45% (p=0.000 n=9+10) IPPrefixMasking/IPv6_/65-8 4.01ns ± 4% 6.23ns ± 0% +55.53% (p=0.000 n=10+9) IPPrefixMasking/IPv6_/0-8 3.95ns ± 1% 6.36ns ± 4% +61.09% (p=0.000 n=8+10) IPPrefixMasking/IPv6_zone_/128-8 3.94ns ± 0% 107.53ns ± 2% +2626.16% (p=0.000 n=8+10) IPPrefixMasking/IPv6_zone_/65-8 3.95ns ± 0% 106.50ns ± 0% +2596.05% (p=0.000 n=9+10) IPPrefixMasking/IPv6_zone_/0-8 3.95ns ± 0% 107.22ns ± 0% +2617.08% (p=0.000 n=9+8) IPPrefixMarshalText-8 28.8ns ± 1% 39.4ns ± 1% +36.75% (p=0.000 n=10+10) ParseIPPort/v4-8 27.0ns ± 1% 27.1ns ± 1% +0.53% (p=0.041 n=10+9) ParseIPPort/v6-8 81.7ns ± 1% 81.1ns ± 1% -0.73% (p=0.037 n=10+10) ParseIPPort/v6_ellipsis-8 56.9ns ± 2% 55.8ns ± 1% -1.80% (p=0.000 n=10+9) ParseIPPort/v6_v4-8 55.8ns ± 1% 56.0ns ± 1% ~ (p=0.204 n=10+9) ParseIPPort/v6_zone-8 101ns ± 0% 102ns ± 0% +1.68% (p=0.000 n=8+9) IPRangePrefixes-8 563ns ± 1% 738ns ± 1% +31.05% (p=0.000 n=9+9) IPRangePrefix-8 13.1ns ± 0% 17.1ns ± 1% +30.13% (p=0.000 n=8+10) IPNextPrior-8 135ns ± 1% 135ns ± 1% ~ (p=0.439 n=10+10) name old alloc/op new alloc/op delta IPSetFuzz-8 1.90kB ± 1% 1.90kB ± 1% ~ (p=0.956 n=10+10) StdIPv4-8 16.0B ± 0% 16.0B ± 0% ~ (all equal) IPv4-8 0.00B 0.00B ~ (all equal) IPv4_inline-8 0.00B 0.00B ~ (all equal) StdIPv6-8 16.0B ± 0% 16.0B ± 0% ~ (all equal) IPv6-8 0.00B 0.00B ~ (all equal) IPv4Contains-8 0.00B 0.00B ~ (all equal) IPv6Contains-8 0.00B 0.00B ~ (all equal) ParseIP/v4-8 0.00B 0.00B ~ (all equal) ParseIP/v6-8 0.00B 0.00B ~ (all equal) ParseIP/v6_ellipsis-8 0.00B 0.00B ~ (all equal) ParseIP/v6_v4-8 0.00B 0.00B ~ (all equal) ParseIP/v6_zone-8 0.00B 0.00B ~ (all equal) StdParseIP/v4-8 16.0B ± 0% 16.0B ± 0% ~ (all equal) StdParseIP/v6-8 16.0B ± 0% 16.0B ± 0% ~ (all equal) StdParseIP/v6_ellipsis-8 16.0B ± 0% 16.0B ± 0% ~ (all equal) StdParseIP/v6_v4-8 32.0B ± 0% 32.0B ± 0% ~ (all equal) StdParseIP/v6_zone-8 16.0B ± 0% 16.0B ± 0% ~ (all equal) IPString/v4-8 16.0B ± 0% 16.0B ± 0% ~ (all equal) IPString/v6-8 48.0B ± 0% 48.0B ± 0% ~ (all equal) IPString/v6_ellipsis-8 24.0B ± 0% 24.0B ± 0% ~ (all equal) IPString/v6_v4-8 16.0B ± 0% 16.0B ± 0% ~ (all equal) IPString/v6_zone-8 24.0B ± 0% 24.0B ± 0% ~ (all equal) IPMarshalText-8 16.0B ± 0% 16.0B ± 0% ~ (all equal) IPPortString/v4-8 26.0B ± 0% 26.0B ± 0% ~ (all equal) IPPortString/v6-8 101B ± 0% 101B ± 0% ~ (all equal) IPPortString/v6_ellipsis-8 61.0B ± 0% 61.0B ± 0% ~ (all equal) IPPortString/v6_v4-8 45.0B ± 0% 45.0B ± 0% ~ (all equal) IPPortString/v6_zone-8 61.0B ± 0% 61.0B ± 0% ~ (all equal) IPPortMarshalText/v4-8 24.0B ± 0% 24.0B ± 0% ~ (all equal) IPPortMarshalText/v6-8 64.0B ± 0% 64.0B ± 0% ~ (all equal) IPPortMarshalText/v6_ellipsis-8 64.0B ± 0% 64.0B ± 0% ~ (all equal) IPPortMarshalText/v6_v4-8 64.0B ± 0% 64.0B ± 0% ~ (all equal) IPPortMarshalText/v6_zone-8 64.0B ± 0% 64.0B ± 0% ~ (all equal) IPPrefixMasking/IPv4_/32-8 0.00B 0.00B ~ (all equal) IPPrefixMasking/IPv4_/17-8 0.00B 0.00B ~ (all equal) IPPrefixMasking/IPv4_/0-8 0.00B 0.00B ~ (all equal) IPPrefixMasking/IPv6_/128-8 0.00B 0.00B ~ (all equal) IPPrefixMasking/IPv6_/65-8 0.00B 0.00B ~ (all equal) IPPrefixMasking/IPv6_/0-8 0.00B 0.00B ~ (all equal) IPPrefixMasking/IPv6_zone_/128-8 0.00B 24.00B ± 0% +Inf% (p=0.000 n=10+10) IPPrefixMasking/IPv6_zone_/65-8 0.00B 24.00B ± 0% +Inf% (p=0.000 n=10+10) IPPrefixMasking/IPv6_zone_/0-8 0.00B 24.00B ± 0% +Inf% (p=0.000 n=10+10) IPPrefixMarshalText-8 24.0B ± 0% 24.0B ± 0% ~ (all equal) ParseIPPort/v4-8 0.00B 0.00B ~ (all equal) ParseIPPort/v6-8 0.00B 0.00B ~ (all equal) ParseIPPort/v6_ellipsis-8 0.00B 0.00B ~ (all equal) ParseIPPort/v6_v4-8 0.00B 0.00B ~ (all equal) ParseIPPort/v6_zone-8 0.00B 0.00B ~ (all equal) IPRangePrefixes-8 0.00B 0.00B ~ (all equal) IPRangePrefix-8 0.00B 0.00B ~ (all equal) name old allocs/op new allocs/op delta IPSetFuzz-8 30.0 ± 0% 30.0 ± 0% ~ (all equal) StdIPv4-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) IPv4-8 0.00 0.00 ~ (all equal) IPv4_inline-8 0.00 0.00 ~ (all equal) StdIPv6-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) IPv6-8 0.00 0.00 ~ (all equal) IPv4Contains-8 0.00 0.00 ~ (all equal) IPv6Contains-8 0.00 0.00 ~ (all equal) ParseIP/v4-8 0.00 0.00 ~ (all equal) ParseIP/v6-8 0.00 0.00 ~ (all equal) ParseIP/v6_ellipsis-8 0.00 0.00 ~ (all equal) ParseIP/v6_v4-8 0.00 0.00 ~ (all equal) ParseIP/v6_zone-8 0.00 0.00 ~ (all equal) StdParseIP/v4-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) StdParseIP/v6-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) StdParseIP/v6_ellipsis-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) StdParseIP/v6_v4-8 2.00 ± 0% 2.00 ± 0% ~ (all equal) StdParseIP/v6_zone-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) IPString/v4-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) IPString/v6-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) IPString/v6_ellipsis-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) IPString/v6_v4-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) IPString/v6_zone-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) IPMarshalText-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) IPPortString/v4-8 2.00 ± 0% 2.00 ± 0% ~ (all equal) IPPortString/v6-8 3.00 ± 0% 3.00 ± 0% ~ (all equal) IPPortString/v6_ellipsis-8 3.00 ± 0% 3.00 ± 0% ~ (all equal) IPPortString/v6_v4-8 3.00 ± 0% 3.00 ± 0% ~ (all equal) IPPortString/v6_zone-8 3.00 ± 0% 3.00 ± 0% ~ (all equal) IPPortMarshalText/v4-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) IPPortMarshalText/v6-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) IPPortMarshalText/v6_ellipsis-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) IPPortMarshalText/v6_v4-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) IPPortMarshalText/v6_zone-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) IPPrefixMasking/IPv4_/32-8 0.00 0.00 ~ (all equal) IPPrefixMasking/IPv4_/17-8 0.00 0.00 ~ (all equal) IPPrefixMasking/IPv4_/0-8 0.00 0.00 ~ (all equal) IPPrefixMasking/IPv6_/128-8 0.00 0.00 ~ (all equal) IPPrefixMasking/IPv6_/65-8 0.00 0.00 ~ (all equal) IPPrefixMasking/IPv6_/0-8 0.00 0.00 ~ (all equal) IPPrefixMasking/IPv6_zone_/128-8 0.00 1.00 ± 0% +Inf% (p=0.000 n=10+10) IPPrefixMasking/IPv6_zone_/65-8 0.00 1.00 ± 0% +Inf% (p=0.000 n=10+10) IPPrefixMasking/IPv6_zone_/0-8 0.00 1.00 ± 0% +Inf% (p=0.000 n=10+10) IPPrefixMarshalText-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) ParseIPPort/v4-8 0.00 0.00 ~ (all equal) ParseIPPort/v6-8 0.00 0.00 ~ (all equal) ParseIPPort/v6_ellipsis-8 0.00 0.00 ~ (all equal) ParseIPPort/v6_v4-8 0.00 0.00 ~ (all equal) ParseIPPort/v6_zone-8 0.00 0.00 ~ (all equal) IPRangePrefixes-8 0.00 0.00 ~ (all equal) IPRangePrefix-8 0.00 0.00 ~ (all equal) Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
As usual, the interesting details are in the commit message. Thanks, GitHub, for making it hard to see those. I'd say this is a failed experiment. I'm going to close the PR now, but I wanted to have the code and results available for others to see. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.