BLAKE3-team / BLAKE3

the official Rust and C implementations of the BLAKE3 cryptographic hash function
Apache License 2.0
5.06k stars 346 forks source link

Switch to rayon-core for faster build #400

Closed silvanshade closed 3 months ago

silvanshade commented 3 months ago

This reduces the build time (with --timings) for blake3 from around 1.7s to 1.3s on a Zen4 7950x.

This helps for situations where one is trying to minimize build time (e.g., for build-dependencies).

There seems to be no real downside since the crate doesn't use anything not included in the core rayon crate.

Below I've included the results from cargo build --timings.

The improvement doesn't really show up for b3sum on my system since other dependencies take long enough that it masks the difference. But it's still probably better to switch them both and maybe in some scenario the difference would surface.

b3sum-rayon-core.pdf b3sum-rayon.pdf blake3-rayon-core.pdf blake3-rayon.pdf

oconnor663 commented 3 months ago

Wow yeah, if I do cargo clean && time cargo build on my box, this change brings it down from ~2.0s to ~1.2s. That's a surprisingly big difference. Thanks!