perf: Improved dec_octet parsing

Removed the list folding method and reverted to a standard
try_parser/parse_this_then method as used in the rest of the parser
This commit is contained in:
2025-09-14 21:28:30 +01:00
parent 2ee6741308
commit 6131aa01e7
4 changed files with 114 additions and 34 deletions

View File

@@ -12,6 +12,28 @@ pub fn main() {
parse_benchmark()
// reg_name_benchmark()
// ip_benchmark()
}
@target(erlang)
pub fn ip_benchmark() {
benchmark.run(
[
benchmark.Function("ip_benchmark", fn(data) {
fn() {
let _ = parser.parse_dec_octet(data)
Nil
}
}),
],
[
benchmark.Data("173", "173"),
benchmark.Data("5", "5"),
benchmark.Data("200", "200"),
benchmark.Data("255", "255"),
benchmark.Data("fail", "2b"),
],
)
}
@target(erlang)