A benchmark for UTF-8 parsing performance was added. Using this
benchmark, several strategies for parsing were tested versus the
original lookup table implementation:
Pure match
name pure_lookup ns/iter pure_match ns/iter diff ns/iter diff % speedup
tests::parse_bench_utf8_demo 68,984 52,731 -16,253 -23.56% x 1.31
tests::std_string_parse_utf8 42,472 42,144 -328 -0.77% x 1.01
Match with packed lookup in Ground state
name pure_lookup ns/iter match_and_lookup ns/iter diff ns/iter diff % speedup
tests::parse_bench_utf8_demo 68,984 68,922 -62 -0.09% x 1.00
tests::std_string_parse_utf8 42,472 36,788 -5,684 -13.38% x 1.15
Match with unpacked lookup in Ground state
name pure_lookup ns/iter match_and_lookup_unpacked ns/iter diff ns/iter diff % speedup
tests::parse_bench_utf8_demo 68,984 63,727 -5,257 -7.62% x 1.08
tests::std_string_parse_utf8 42,472 42,787 315 0.74% x 0.99
Of these implementations, the pure match peformed best in
microbenchmarks, and that is the implementation retained in this commit.
A benchmark for UTF-8 parsing performance was added. Using this benchmark, several strategies for parsing were tested versus the original lookup table implementation:
Pure match
name pure_lookup ns/iter pure_match ns/iter diff ns/iter diff % speedup tests::parse_bench_utf8_demo 68,984 52,731 -16,253 -23.56% x 1.31 tests::std_string_parse_utf8 42,472 42,144 -328 -0.77% x 1.01
Match with packed lookup in Ground state
name pure_lookup ns/iter match_and_lookup ns/iter diff ns/iter diff % speedup tests::parse_bench_utf8_demo 68,984 68,922 -62 -0.09% x 1.00 tests::std_string_parse_utf8 42,472 36,788 -5,684 -13.38% x 1.15
Match with unpacked lookup in Ground state
name pure_lookup ns/iter match_and_lookup_unpacked ns/iter diff ns/iter diff % speedup tests::parse_bench_utf8_demo 68,984 63,727 -5,257 -7.62% x 1.08 tests::std_string_parse_utf8 42,472 42,787 315 0.74% x 0.99
Of these implementations, the pure match peformed best in microbenchmarks, and that is the implementation retained in this commit.