Faster implementations of standard library operations like find, filter, position etc.
Rust
186
70 commits
updated Feb 8, 2025
let needles = [42, 52, 94];
arr.iter().any_simd(|x| needles.contains(x) || x > 156);
Currently the following are implemented:
find
filter
position
all
any
argmin/argmax
Every piece of software makes tradeoffs. The goal of this library it to provide the majority of performance gains gained from going scalar -> vectorized, while staying user-friendly. If you are looking to shave off the last few cycles this might not be what you are looking for.
The library makes one extra assumption over the stdlib: The closure may be executed any number of times:
arr.iter().simd_position(|x| {
println!("hello world");
*x == 42
})
May print a different number of times compared to the standard library. This shouldn't be an issue under normal use-cases but something to keep in mind.
It's tricky. Hopefully one day.
Rust
100.0%
Faster implementations of standard library operations like find, filter, position etc.
Rust
186
70 commits
updated Feb 8, 2025
let needles = [42, 52, 94];
arr.iter().any_simd(|x| needles.contains(x) || x > 156);
Currently the following are implemented:
find
filter
position
all
any
argmin/argmax
Every piece of software makes tradeoffs. The goal of this library it to provide the majority of performance gains gained from going scalar -> vectorized, while staying user-friendly. If you are looking to shave off the last few cycles this might not be what you are looking for.
The library makes one extra assumption over the stdlib: The closure may be executed any number of times:
arr.iter().simd_position(|x| {
println!("hello world");
*x == 42
})
May print a different number of times compared to the standard library. This shouldn't be an issue under normal use-cases but something to keep in mind.
It's tricky. Hopefully one day.
Rust
100.0%