We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why do I get only about 12 GB/s with this manual benchmark?
12 GB/s
use std::time::Instant; use simdutf8::basic::from_utf8; fn main() { let mut vec: Vec<u8> = Vec::new(); for i in 0..1024 * 1024 * 10 { vec.push((i % 10) as u8 + b'0'); } // println!("{:?}", vec); println!("{}", from_utf8(b"I \xE2\x9D\xA4\xEF\xB8\x8F UTF-8!").unwrap()); let start = Instant::now(); let decoded = from_utf8(vec.as_slice()).unwrap(); // let decoded = std::str::from_utf8(vec.as_slice()).unwrap(); println!("length: {}", decoded.len()); let mut elapsed = Instant::now().duration_since(start); println!("Elapsed time: {:?}", elapsed); let giga = 1024 * 1024 * 1024; println!("Speed: {:?} GB/s", 1000000.0 / (elapsed.as_micros() as f64) * (vec.len() as f64) / (giga as f64)); }
When I run the benchmark (slightly patched), I get about 80 GB/s.
80 GB/s
1-latin/1048576 time: [12.134 µs 12.144 µs 12.155 µs] thrpt: [80.339 GiB/s 80.416 GiB/s 80.481 GiB/s]
The text was updated successfully, but these errors were encountered:
cargo 1.65.0 (4bc8f24d3 2022-10-20) and Apple M1 Pro
cargo 1.65.0 (4bc8f24d3 2022-10-20)
Apple M1 Pro
Sorry, something went wrong.
No branches or pull requests
Why do I get only about
12 GB/s
with this manual benchmark?When I run the benchmark (slightly patched), I get about
80 GB/s
.The text was updated successfully, but these errors were encountered: