rust-av / ssimulacra2_bin

Binary interface for the ssimulacra2 Rust port
BSD 2-Clause "Simplified" License
40 stars 10 forks source link

Investigate `rayon` impact in multi-threaded scenarios #21

Closed FreezyLemon closed 7 months ago

FreezyLemon commented 1 year ago

A simple test:

  1. git checkout main
  2. Modify Cargo.toml and turn off rayon by disabling default features: ssimulacra2 = { version = "=0.3.1", default-features = false }
  3. Try using video mode with and without default-features = false with different -f X values.

For me, there is a point where ssimu2 with rayon enabled is actually slower than the same without rayon: -f 3 and higher.

I suspect this is due to contention on either memory on cache from the rayon threads (activating rayon almost triples my CPU usage for a given -f! with not even 20% perf increase even in -f 1), but I can't say for sure. Given that the binary interface supports a better mode of threading, I'd suggest actually disabling the rayon feature here if this can be reproduced across the board.