Optimize network address parser#158053
Conversation
|
r? @joboet rustbot has assigned @joboet. Use Why was this reviewer chosen?The reviewer was selected based on:
|
85f8eec to
7255f6a
Compare
There was a problem hiding this comment.
Uh, if joboet has an opinion otherwise, that's cool, but if we're going to hoist out the decimal implementation into its own thing, can't we just replace read_number with read_decimal and read_hex instead of this read_radix_max_digits function? It's only ever called with those two radixes and is internal anyways?
|
Reminder, once the PR becomes ready for a review, use |
Split `read_number()` into seperate methods for the the `max_digits` `Some(_)` and `None` cases. Hoist reading the first digit which is always required. The path for unlimited digits then no longer has to count digits at all.
7255f6a to
1d54265
Compare
|
A job failed! Check out the build log: (web) (plain enhanced) (plain) Click to see the possible cause of the failure (guessed by this bot) |
Tried that initially, but splitting across max_digits vs. unlimited appears to be more impactful than splitting across radix. Other feedback applied and ready for the next round of review. @rustbot ready |
|
can you quantify "more impactful"? |
|
Or like, broadly describe even? "more impactful" doesn't really tell me anything. |
|
And my apologies about the initial inquiry, I only felt compelled to ask because I truly felt baffled by the sentence. I was at various levels of "surely that's not what you meant?" with myself and "I have to ask, but...?" and the simplification/explained version is quite understandable. |
|
No worries, and thanks for still leaving a review in the first place.
fn read_decimal<T: ReadNumberHelper + TryFrom<u32>>(&mut self, max_digits: Opton<usize>, allow_zero_prefix: bool) -> Option<T> { ... }
fn read_4_hex_digits(&mut self) -> Option<u16> { ... }With that I measure: |
There was a problem hiding this comment.
There may be a more "proper" way to rerun the PR CI but every time I am told about it I recall thinking, "That seems like more effort, though?"
read_hex()ends up with exactly one call-site in IPv6 parsing,
Right, I had an optimistic assumption that code duplication might actually be fine here for performance reasons.
It looks like the numbers are... rereads the tables a couple times. Oh. I see! That is indeed less impactful. The benchmarking framework itself is not exactly the best implementation of benchmarking, so I do wonder slightly about variance, but it's good enough that this is a clear improvement. Thanks!
...I wonder if it's because it's actually routing less logic through sufficiently-similar-looking codepaths so that LLVM infers the optimization is less important...? Or it's just not as easy for CSE/GVN...? Well, either way.
r? me
@bors r+
…gjubilee
Optimize network address parser
Motivated by working with datasets of IP addresses.
First commit adds more examples for each case in the benchmark suite.
Second commit splits `read_number()` into seperate methods for the the `max_digits` `Some(_)` and `None` cases, which by itself significantly helps code generation.
Hoist reading the first digit which is always required.
The path for unlimited digits then no longer has to count digits at all.
Drive-by "fixes" the 10 digit debug assertion (which would be insufficient in base 16). Not actually used anywhere near the limit.
`./x bench library/coretests --test-args addr_parser` before -> after on AMD Ryzen 9 9950X:
net::addr_parser::bench_parse_ipaddr_v4 81.73ns/iter +/- 0.60 -> 62.36ns/iter +/- 0.12
net::addr_parser::bench_parse_ipaddr_v6_compress 303.70ns/iter +/- 1.29 -> 212.80ns/iter +/- 1.25
net::addr_parser::bench_parse_ipaddr_v6_full 453.06ns/iter +/- 7.89 -> 294.88ns/iter +/- 0.91
net::addr_parser::bench_parse_ipaddr_v6_v4 301.41ns/iter +/- 1.52 -> 224.82ns/iter +/- 0.99
net::addr_parser::bench_parse_ipv4 87.24ns/iter +/- 0.32 -> 52.94ns/iter +/- 0.33
net::addr_parser::bench_parse_ipv6_compress 277.92ns/iter +/- 3.29 -> 195.98ns/iter +/- 1.10
net::addr_parser::bench_parse_ipv6_full 402.48ns/iter +/- 22.20 -> 276.37ns/iter +/- 4.05
net::addr_parser::bench_parse_ipv6_v4 276.78ns/iter +/- 1.18 -> 216.04ns/iter +/- 1.20
net::addr_parser::bench_parse_socket_v4 105.18ns/iter +/- 0.79 -> 69.20ns/iter +/- 0.46
net::addr_parser::bench_parse_socket_v6 378.69ns/iter +/- 5.25 -> 274.82ns/iter +/- 0.95
net::addr_parser::bench_parse_socket_v6_scope_id 336.61ns/iter +/- 2.36 -> 258.56ns/iter +/- 0.89
net::addr_parser::bench_parse_socketaddr_v4 118.20ns/iter +/- 0.66 -> 78.86ns/iter +/- 0.22
net::addr_parser::bench_parse_socketaddr_v6 429.17ns/iter +/- 5.70 -> 315.69ns/iter +/- 1.48
Rollup of 27 pull requests Successful merges: - #158315 (`rust-analyzer` subtree update) - #155739 (Add temporary scope to assert_eq and assert_ne) - #156885 (Fix misattributed type inference error span for index expressions) - #157271 (simplify some `proc_macro` things) - #157883 (Remove strict invariant node_type on hir_type during ty privacy visit) - #157921 (trait solver: Resolve region vars in max universe) - #157960 (delegation: add support for infers in generics) - #157983 (Lift the same-signature restriction for `extern "tail"`) - #158053 (Optimize network address parser) - #158105 (Extract all instance shim variants into new `ShimKind` enum) - #158207 (Resolver: local/external split of `resolve_ident_in_module_non_globs_unadjusted` ) - #158279 (Follow goto and drop when linting unreachable code) - #157527 (Move derive tests into their dedicated folder) - #157807 (don't ice on non-lifetime binders under `-Zassumptions-on-binders`) - #158020 (Update mingw-w64 C toolchain) - #158039 (c-variadic: test that we use equality up to free lifetimes) - #158222 (format: ignore println newline in foreign format hints) - #158223 (Move target checking for #[lang] to the attribute parser) - #158252 (Use `cfg_select` in `std::os`) - #158257 ( fix escaping placeholder check in next solver normalization folder) - #158263 (Only load the feature list once in the entire resolver) - #158267 (FromUtf8Error::into_utf8_lossy better example and suggest use) - #158274 (triagebot: Stop pinging myself) - #158282 (slice_split_once: bounds check optimization note) - #158300 (Improve unknown crate_type diagnostic suggestions) - #158304 (mailmap: update mu001999) - #158309 (Update `rustc-literal-escaper` version to `0.0.8`) Failed merges: - #158256 (Avoid parser panics bubbling out to proc macros)
…gjubilee
Optimize network address parser
Motivated by working with datasets of IP addresses.
First commit adds more examples for each case in the benchmark suite.
Second commit splits `read_number()` into seperate methods for the the `max_digits` `Some(_)` and `None` cases, which by itself significantly helps code generation.
Hoist reading the first digit which is always required.
The path for unlimited digits then no longer has to count digits at all.
Drive-by "fixes" the 10 digit debug assertion (which would be insufficient in base 16). Not actually used anywhere near the limit.
`./x bench library/coretests --test-args addr_parser` before -> after on AMD Ryzen 9 9950X:
net::addr_parser::bench_parse_ipaddr_v4 81.73ns/iter +/- 0.60 -> 62.36ns/iter +/- 0.12
net::addr_parser::bench_parse_ipaddr_v6_compress 303.70ns/iter +/- 1.29 -> 212.80ns/iter +/- 1.25
net::addr_parser::bench_parse_ipaddr_v6_full 453.06ns/iter +/- 7.89 -> 294.88ns/iter +/- 0.91
net::addr_parser::bench_parse_ipaddr_v6_v4 301.41ns/iter +/- 1.52 -> 224.82ns/iter +/- 0.99
net::addr_parser::bench_parse_ipv4 87.24ns/iter +/- 0.32 -> 52.94ns/iter +/- 0.33
net::addr_parser::bench_parse_ipv6_compress 277.92ns/iter +/- 3.29 -> 195.98ns/iter +/- 1.10
net::addr_parser::bench_parse_ipv6_full 402.48ns/iter +/- 22.20 -> 276.37ns/iter +/- 4.05
net::addr_parser::bench_parse_ipv6_v4 276.78ns/iter +/- 1.18 -> 216.04ns/iter +/- 1.20
net::addr_parser::bench_parse_socket_v4 105.18ns/iter +/- 0.79 -> 69.20ns/iter +/- 0.46
net::addr_parser::bench_parse_socket_v6 378.69ns/iter +/- 5.25 -> 274.82ns/iter +/- 0.95
net::addr_parser::bench_parse_socket_v6_scope_id 336.61ns/iter +/- 2.36 -> 258.56ns/iter +/- 0.89
net::addr_parser::bench_parse_socketaddr_v4 118.20ns/iter +/- 0.66 -> 78.86ns/iter +/- 0.22
net::addr_parser::bench_parse_socketaddr_v6 429.17ns/iter +/- 5.70 -> 315.69ns/iter +/- 1.48
…gjubilee
Optimize network address parser
Motivated by working with datasets of IP addresses.
First commit adds more examples for each case in the benchmark suite.
Second commit splits `read_number()` into seperate methods for the the `max_digits` `Some(_)` and `None` cases, which by itself significantly helps code generation.
Hoist reading the first digit which is always required.
The path for unlimited digits then no longer has to count digits at all.
Drive-by "fixes" the 10 digit debug assertion (which would be insufficient in base 16). Not actually used anywhere near the limit.
`./x bench library/coretests --test-args addr_parser` before -> after on AMD Ryzen 9 9950X:
net::addr_parser::bench_parse_ipaddr_v4 81.73ns/iter +/- 0.60 -> 62.36ns/iter +/- 0.12
net::addr_parser::bench_parse_ipaddr_v6_compress 303.70ns/iter +/- 1.29 -> 212.80ns/iter +/- 1.25
net::addr_parser::bench_parse_ipaddr_v6_full 453.06ns/iter +/- 7.89 -> 294.88ns/iter +/- 0.91
net::addr_parser::bench_parse_ipaddr_v6_v4 301.41ns/iter +/- 1.52 -> 224.82ns/iter +/- 0.99
net::addr_parser::bench_parse_ipv4 87.24ns/iter +/- 0.32 -> 52.94ns/iter +/- 0.33
net::addr_parser::bench_parse_ipv6_compress 277.92ns/iter +/- 3.29 -> 195.98ns/iter +/- 1.10
net::addr_parser::bench_parse_ipv6_full 402.48ns/iter +/- 22.20 -> 276.37ns/iter +/- 4.05
net::addr_parser::bench_parse_ipv6_v4 276.78ns/iter +/- 1.18 -> 216.04ns/iter +/- 1.20
net::addr_parser::bench_parse_socket_v4 105.18ns/iter +/- 0.79 -> 69.20ns/iter +/- 0.46
net::addr_parser::bench_parse_socket_v6 378.69ns/iter +/- 5.25 -> 274.82ns/iter +/- 0.95
net::addr_parser::bench_parse_socket_v6_scope_id 336.61ns/iter +/- 2.36 -> 258.56ns/iter +/- 0.89
net::addr_parser::bench_parse_socketaddr_v4 118.20ns/iter +/- 0.66 -> 78.86ns/iter +/- 0.22
net::addr_parser::bench_parse_socketaddr_v6 429.17ns/iter +/- 5.70 -> 315.69ns/iter +/- 1.48
Rollup of 35 pull requests Successful merges: - #158315 (`rust-analyzer` subtree update) - #158336 (Stop excluding `stdarch` test crates from `rust-src`) - #155739 (Add temporary scope to assert_eq and assert_ne) - #156885 (Fix misattributed type inference error span for index expressions) - #157271 (simplify some `proc_macro` things) - #157419 (move rustc_type_ir Term things to term_kind.rs) - #157883 (Remove strict invariant node_type on hir_type during ty privacy visit) - #157921 (trait solver: Resolve region vars in max universe) - #157960 (delegation: add support for infers in generics) - #157983 (Lift the same-signature restriction for `extern "tail"`) - #158053 (Optimize network address parser) - #158105 (Extract all instance shim variants into new `ShimKind` enum) - #158207 (Resolver: local/external split of `resolve_ident_in_module_non_globs_unadjusted` ) - #158279 (Follow goto and drop when linting unreachable code) - #157527 (Move derive tests into their dedicated folder) - #157807 (don't ice on non-lifetime binders under `-Zassumptions-on-binders`) - #157939 (Reorganize `tests/ui/issues` [8/N]) - #157946 (Make `char::is_private_use` and `char::is_assigned` unstably public) - #158003 (Reorganize `tests/ui/issues` [9/N]) - #158020 (Update mingw-w64 C toolchain) - #158039 (c-variadic: test that we use equality up to free lifetimes) - #158060 (Reorganize `tests/ui/issues` [10/N]) - #158222 (format: ignore println newline in foreign format hints) - #158223 (Move target checking for #[lang] to the attribute parser) - #158252 (Use `cfg_select` in `std::os`) - #158263 (Only load the feature list once in the entire resolver) - #158267 (FromUtf8Error::into_utf8_lossy better example and suggest use) - #158272 (Reorganize `tests/ui/issues` [13/N]) - #158274 (triagebot: Stop pinging myself) - #158282 (slice_split_once: bounds check optimization note) - #158300 (Improve unknown crate_type diagnostic suggestions) - #158304 (mailmap: update mu001999) - #158309 (Update `rustc-literal-escaper` version to `0.0.8`) - #158314 (Fix incorrect unsafe debug assertion in unchecked_div_exact) - #158326 (Add `io::ErrorKind::TooManyOpenFiles`)
Rollup of 35 pull requests Successful merges: - #158315 (`rust-analyzer` subtree update) - #158336 (Stop excluding `stdarch` test crates from `rust-src`) - #155739 (Add temporary scope to assert_eq and assert_ne) - #156885 (Fix misattributed type inference error span for index expressions) - #157271 (simplify some `proc_macro` things) - #157419 (move rustc_type_ir Term things to term_kind.rs) - #157883 (Remove strict invariant node_type on hir_type during ty privacy visit) - #157921 (trait solver: Resolve region vars in max universe) - #157960 (delegation: add support for infers in generics) - #157983 (Lift the same-signature restriction for `extern "tail"`) - #158053 (Optimize network address parser) - #158105 (Extract all instance shim variants into new `ShimKind` enum) - #158207 (Resolver: local/external split of `resolve_ident_in_module_non_globs_unadjusted` ) - #158279 (Follow goto and drop when linting unreachable code) - #157527 (Move derive tests into their dedicated folder) - #157807 (don't ice on non-lifetime binders under `-Zassumptions-on-binders`) - #157939 (Reorganize `tests/ui/issues` [8/N]) - #157946 (Make `char::is_private_use` and `char::is_assigned` unstably public) - #158003 (Reorganize `tests/ui/issues` [9/N]) - #158020 (Update mingw-w64 C toolchain) - #158039 (c-variadic: test that we use equality up to free lifetimes) - #158060 (Reorganize `tests/ui/issues` [10/N]) - #158222 (format: ignore println newline in foreign format hints) - #158223 (Move target checking for #[lang] to the attribute parser) - #158252 (Use `cfg_select` in `std::os`) - #158263 (Only load the feature list once in the entire resolver) - #158267 (FromUtf8Error::into_utf8_lossy better example and suggest use) - #158272 (Reorganize `tests/ui/issues` [13/N]) - #158274 (triagebot: Stop pinging myself) - #158282 (slice_split_once: bounds check optimization note) - #158300 (Improve unknown crate_type diagnostic suggestions) - #158304 (mailmap: update mu001999) - #158309 (Update `rustc-literal-escaper` version to `0.0.8`) - #158314 (Fix incorrect unsafe debug assertion in unchecked_div_exact) - #158326 (Add `io::ErrorKind::TooManyOpenFiles`)
Rollup of 35 pull requests Successful merges: - #158315 (`rust-analyzer` subtree update) - #158336 (Stop excluding `stdarch` test crates from `rust-src`) - #155739 (Add temporary scope to assert_eq and assert_ne) - #156885 (Fix misattributed type inference error span for index expressions) - #157271 (simplify some `proc_macro` things) - #157419 (move rustc_type_ir Term things to term_kind.rs) - #157883 (Remove strict invariant node_type on hir_type during ty privacy visit) - #157921 (trait solver: Resolve region vars in max universe) - #157960 (delegation: add support for infers in generics) - #157983 (Lift the same-signature restriction for `extern "tail"`) - #158053 (Optimize network address parser) - #158105 (Extract all instance shim variants into new `ShimKind` enum) - #158207 (Resolver: local/external split of `resolve_ident_in_module_non_globs_unadjusted` ) - #158279 (Follow goto and drop when linting unreachable code) - #157527 (Move derive tests into their dedicated folder) - #157807 (don't ice on non-lifetime binders under `-Zassumptions-on-binders`) - #157939 (Reorganize `tests/ui/issues` [8/N]) - #157946 (Make `char::is_private_use` and `char::is_assigned` unstably public) - #158003 (Reorganize `tests/ui/issues` [9/N]) - #158020 (Update mingw-w64 C toolchain) - #158039 (c-variadic: test that we use equality up to free lifetimes) - #158060 (Reorganize `tests/ui/issues` [10/N]) - #158222 (format: ignore println newline in foreign format hints) - #158223 (Move target checking for #[lang] to the attribute parser) - #158252 (Use `cfg_select` in `std::os`) - #158263 (Only load the feature list once in the entire resolver) - #158267 (FromUtf8Error::into_utf8_lossy better example and suggest use) - #158272 (Reorganize `tests/ui/issues` [13/N]) - #158274 (triagebot: Stop pinging myself) - #158282 (slice_split_once: bounds check optimization note) - #158300 (Improve unknown crate_type diagnostic suggestions) - #158304 (mailmap: update mu001999) - #158309 (Update `rustc-literal-escaper` version to `0.0.8`) - #158314 (Fix incorrect unsafe debug assertion in unchecked_div_exact) - #158326 (Add `io::ErrorKind::TooManyOpenFiles`)
Rollup of 35 pull requests Successful merges: - #158315 (`rust-analyzer` subtree update) - #158336 (Stop excluding `stdarch` test crates from `rust-src`) - #155739 (Add temporary scope to assert_eq and assert_ne) - #156885 (Fix misattributed type inference error span for index expressions) - #157271 (simplify some `proc_macro` things) - #157419 (move rustc_type_ir Term things to term_kind.rs) - #157883 (Remove strict invariant node_type on hir_type during ty privacy visit) - #157921 (trait solver: Resolve region vars in max universe) - #157960 (delegation: add support for infers in generics) - #157983 (Lift the same-signature restriction for `extern "tail"`) - #158053 (Optimize network address parser) - #158105 (Extract all instance shim variants into new `ShimKind` enum) - #158207 (Resolver: local/external split of `resolve_ident_in_module_non_globs_unadjusted` ) - #158279 (Follow goto and drop when linting unreachable code) - #157527 (Move derive tests into their dedicated folder) - #157807 (don't ice on non-lifetime binders under `-Zassumptions-on-binders`) - #157939 (Reorganize `tests/ui/issues` [8/N]) - #157946 (Make `char::is_private_use` and `char::is_assigned` unstably public) - #158003 (Reorganize `tests/ui/issues` [9/N]) - #158020 (Update mingw-w64 C toolchain) - #158039 (c-variadic: test that we use equality up to free lifetimes) - #158060 (Reorganize `tests/ui/issues` [10/N]) - #158222 (format: ignore println newline in foreign format hints) - #158223 (Move target checking for #[lang] to the attribute parser) - #158252 (Use `cfg_select` in `std::os`) - #158263 (Only load the feature list once in the entire resolver) - #158267 (FromUtf8Error::into_utf8_lossy better example and suggest use) - #158272 (Reorganize `tests/ui/issues` [13/N]) - #158274 (triagebot: Stop pinging myself) - #158282 (slice_split_once: bounds check optimization note) - #158300 (Improve unknown crate_type diagnostic suggestions) - #158304 (mailmap: update mu001999) - #158309 (Update `rustc-literal-escaper` version to `0.0.8`) - #158314 (Fix incorrect unsafe debug assertion in unchecked_div_exact) - #158326 (Add `io::ErrorKind::TooManyOpenFiles`)
…gjubilee
Optimize network address parser
Motivated by working with datasets of IP addresses.
First commit adds more examples for each case in the benchmark suite.
Second commit splits `read_number()` into seperate methods for the the `max_digits` `Some(_)` and `None` cases, which by itself significantly helps code generation.
Hoist reading the first digit which is always required.
The path for unlimited digits then no longer has to count digits at all.
Drive-by "fixes" the 10 digit debug assertion (which would be insufficient in base 16). Not actually used anywhere near the limit.
`./x bench library/coretests --test-args addr_parser` before -> after on AMD Ryzen 9 9950X:
net::addr_parser::bench_parse_ipaddr_v4 81.73ns/iter +/- 0.60 -> 62.36ns/iter +/- 0.12
net::addr_parser::bench_parse_ipaddr_v6_compress 303.70ns/iter +/- 1.29 -> 212.80ns/iter +/- 1.25
net::addr_parser::bench_parse_ipaddr_v6_full 453.06ns/iter +/- 7.89 -> 294.88ns/iter +/- 0.91
net::addr_parser::bench_parse_ipaddr_v6_v4 301.41ns/iter +/- 1.52 -> 224.82ns/iter +/- 0.99
net::addr_parser::bench_parse_ipv4 87.24ns/iter +/- 0.32 -> 52.94ns/iter +/- 0.33
net::addr_parser::bench_parse_ipv6_compress 277.92ns/iter +/- 3.29 -> 195.98ns/iter +/- 1.10
net::addr_parser::bench_parse_ipv6_full 402.48ns/iter +/- 22.20 -> 276.37ns/iter +/- 4.05
net::addr_parser::bench_parse_ipv6_v4 276.78ns/iter +/- 1.18 -> 216.04ns/iter +/- 1.20
net::addr_parser::bench_parse_socket_v4 105.18ns/iter +/- 0.79 -> 69.20ns/iter +/- 0.46
net::addr_parser::bench_parse_socket_v6 378.69ns/iter +/- 5.25 -> 274.82ns/iter +/- 0.95
net::addr_parser::bench_parse_socket_v6_scope_id 336.61ns/iter +/- 2.36 -> 258.56ns/iter +/- 0.89
net::addr_parser::bench_parse_socketaddr_v4 118.20ns/iter +/- 0.66 -> 78.86ns/iter +/- 0.22
net::addr_parser::bench_parse_socketaddr_v6 429.17ns/iter +/- 5.70 -> 315.69ns/iter +/- 1.48
Rollup of 35 pull requests Successful merges: - #158315 (`rust-analyzer` subtree update) - #158336 (Stop excluding `stdarch` test crates from `rust-src`) - #155739 (Add temporary scope to assert_eq and assert_ne) - #156885 (Fix misattributed type inference error span for index expressions) - #157271 (simplify some `proc_macro` things) - #157419 (move rustc_type_ir Term things to term_kind.rs) - #157883 (Remove strict invariant node_type on hir_type during ty privacy visit) - #157921 (trait solver: Resolve region vars in max universe) - #157960 (delegation: add support for infers in generics) - #157983 (Lift the same-signature restriction for `extern "tail"`) - #158053 (Optimize network address parser) - #158105 (Extract all instance shim variants into new `ShimKind` enum) - #158207 (Resolver: local/external split of `resolve_ident_in_module_non_globs_unadjusted` ) - #158279 (Follow goto and drop when linting unreachable code) - #157527 (Move derive tests into their dedicated folder) - #157807 (don't ice on non-lifetime binders under `-Zassumptions-on-binders`) - #157939 (Reorganize `tests/ui/issues` [8/N]) - #157946 (Make `char::is_private_use` and `char::is_assigned` unstably public) - #158003 (Reorganize `tests/ui/issues` [9/N]) - #158020 (Update mingw-w64 C toolchain) - #158039 (c-variadic: test that we use equality up to free lifetimes) - #158060 (Reorganize `tests/ui/issues` [10/N]) - #158222 (format: ignore println newline in foreign format hints) - #158223 (Move target checking for #[lang] to the attribute parser) - #158252 (Use `cfg_select` in `std::os`) - #158263 (Only load the feature list once in the entire resolver) - #158267 (FromUtf8Error::into_utf8_lossy better example and suggest use) - #158272 (Reorganize `tests/ui/issues` [13/N]) - #158274 (triagebot: Stop pinging myself) - #158282 (slice_split_once: bounds check optimization note) - #158300 (Improve unknown crate_type diagnostic suggestions) - #158304 (mailmap: update mu001999) - #158309 (Update `rustc-literal-escaper` version to `0.0.8`) - #158314 (Fix incorrect unsafe debug assertion in unchecked_div_exact) - #158326 (Add `io::ErrorKind::TooManyOpenFiles`)
Motivated by working with datasets of IP addresses.
First commit adds more examples for each case in the benchmark suite.
Second commit splits
read_number()into seperate methods for the themax_digitsSome(_)andNonecases, which by itself significantly helps code generation.Hoist reading the first digit which is always required.
The path for unlimited digits then no longer has to count digits at all.
Drive-by "fixes" the 10 digit debug assertion (which would be insufficient in base 16). Not actually used anywhere near the limit.
./x bench library/coretests --test-args addr_parserbefore -> after on AMD Ryzen 9 9950X: