Skip to content
This repository has been archived by the owner on Oct 17, 2022. It is now read-only.

Benchmarking improvements #4

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

milkey-mouse
Copy link

I hooked up benchmarks to the standard library's UTF-8 validator (via std::str::from_utf8) so I could compare with this implementation. (I'm benchmarking some other Rust and even C utf-8 validators more on my own branch, but that seems like something that belongs in its own repository instead of adding every other utf8 validator as a dev-dependency on this project.)

These new benchmarks no longer use the deprecated ParameterizedBenchmark & co., making an upgrade to criterion 0.4 possible when it comes out. They're also generated using generic functions instead of macros, improving readability. I also added an optional feature to use criterion-cycles-per-byte to get cycles-per-byte values for the benchmarks using rdtsc.

@milkey-mouse milkey-mouse force-pushed the better-bench branch 2 times, most recently from ea55ccc to addaf8c Compare June 30, 2020 05:27
@milkey-mouse
Copy link
Author

By the way, what was the point of the point of setting the CPU affinity for the benchmarks? It only runs on one core anyway.

let core_ids = core_affinity::get_core_ids().unwrap();
core_affinity::set_for_current(core_ids[0]);

Two sets of benchmarks are now run, one with this validator and one
with std::str::from_utf8 (a thin, inlined wrapper around the internal
run_utf8_validation function). This commit also changes the benchmark
to use functions instead of macros, slightly improving readability.
There's no need to make a String (and allocate a new Vec) when the same
method is available on &str.
@milkey-mouse
Copy link
Author

Sorry for all the force-pushes, I originally wrote this at 3 AM and messed up a config option/cargo feature.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant