-
Notifications
You must be signed in to change notification settings - Fork 221
Description
Motivation
According to my benchmarks, SIMD parser can be 5x~9x faster than generic implementation and SIMD formatter can be 10x faster than generic implementation.
https://github.com/Nugine/uuid-simd/blob/main/benches/main.rs
https://github.com/Nugine/uuid-simd
Solution
Add SIMD functions and a feature simd.
When simd and std are enabled, use runtime cpu feature detection to dispatch the functions.
When simd is enabled, use conditional compilation to dispatch the functions.
Otherwise, use the fallback functions.
Alternatives
SIMD accelerations don't have to be built-in features. An extension crate (uuid-simd) is also good for users who care about performance.
Is it blocking?
No.
Anything else?
Uuid::try_parse is slightly slower than my impl. I'm testing why this happens. I'll submit a PR if I find the reason.
parse/fallback/simple | 27.286 ns
parse/fallback/hyphenated | 28.057 ns
parse/uuid-latest/simple | 40.266 ns
parse/uuid-latest/hyphenated | 41.445 ns
Edit:
uuid-simd link: https://docs.rs/uuid-simd/0.5.0/uuid_simd/