Skip to content
New issue

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

Fix Rust nightly #135

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bkaestner
Copy link

Fixes #124.

The `portable_simd` feature is currently unstable and thus subject to
arbitrary changes. One of those changes was apparently reorganization
of the traits and types, see [596aabe5]. That change moved the trait
`SimdFloat` trait moved from the `simd` module into `simd::num`. Also,
the `.cast::<f64>` is only available with the `SimdUint` trait (also
now in `simd::num`).

While we could have changed the `use` to using those new paths, it
could still happen that the `simd::*` modules get reorganized in the
future. With this, I've opted to use `std::simd::prelude::*` instead,
which hopefully keeps this code valid until `portable_simd` is stable.

 [596aabe5]: rust-lang/portable-simd@596aabe
@bkaestner
Copy link
Author

By the way, it seems like the Rust-Nightly had some tremendous improvements. I was originally trying to get SBCL faster, but then noticed the open #124. Seems like the SIMD performance went from ~2x to ~3.5x (compared to the non-SIMD Rust version):

hyperfine.exe --warmup 5 -n "Rust" .\leibniz.exe -n "Rust (nightly)" .\leibniz_nightly.exe -n "SBCL (precompiled)" "sbcl --script leibniz.fasl"
Benchmark 1: Rust
  Time (mean ± σ):     129.3 ms ±   0.7 ms    [User: 119.2 ms, System: 6.9 ms]
  Range (min … max):   128.4 ms … 130.8 ms    22 runs

Benchmark 2: Rust (nightly)
  Time (mean ± σ):      36.6 ms ±   0.4 ms    [User: 31.0 ms, System: 6.3 ms]
  Range (min … max):    35.6 ms …  37.6 ms    71 runs

Benchmark 3: SBCL (precompiled)
  Time (mean ± σ):     157.6 ms ±   2.3 ms    [User: 123.4 ms, System: 33.6 ms]
  Range (min … max):   154.5 ms … 161.7 ms    18 runs

Summary
  Rust (nightly) ran
    3.53 ± 0.05 times faster than Rust
    4.31 ± 0.08 times faster than SBCL (precompiled)

(Benchmark run on AMD Ryzen 5 3600 6-Core Processor on Win10 22H2)

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

Successfully merging this pull request may close these issues.

Rust nightly is atm broken
1 participant