# Hash digest performance (Rust vs. Python)

**URL:** <https://users.rust-lang.org/t/hash-digest-performance-rust-vs-python/89686>\
**Category:** code review\
**Created:** [February 21, 2023, 6:07pm UTC](https://users.rust-lang.org/t/hash-digest-performance-rust-vs-python/89686 "2023-02-21T18:07:09Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![ambiso](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/ambiso/32/10843_2.png) [@ambiso](https://users.rust-lang.org/u/ambiso)\
**Post date:** [February 21, 2023, 8:09pm UTC](https://users.rust-lang.org/t/hash-digest-performance-rust-vs-python/89686/10 "2023-02-21T20:09:44Z")

</div>

What OS, CPU and rustc version is this on? Are you running in release mode?

On my system (Ryzen 5900X, Arch Linux with [`export LD_PRELOAD=/usr/lib/libjemalloc.so`](https://users.rust-lang.org/t/std-read-slow/85424/15) and `rustc 1.69.0-nightly`) Rust is slightly faster:

```rust
➜ hash_perf git:(main) ✗ hyperfine ./hash.py          
Benchmark 1: ./hash.py
  Time (mean ± σ): 138.6 ms ± 2.7 ms [User: 110.9 ms, System: 27.5 ms]
  Range (min … max): 133.7 ms … 142.2 ms 21 runs
 
➜ hash_perf git:(main) ✗ cargo build --release; hyperfine ./target/release/hash_perf
    Finished release [optimized] target(s) in 0.00s
Benchmark 1: ./target/release/hash_perf
  Time (mean ± σ): 125.5 ms ± 1.5 ms [User: 98.7 ms, System: 26.5 ms]
  Range (min … max): 121.9 ms … 128.4 ms 23 runs

```

---

_[View the full topic](https://users.rust-lang.org/t/hash-digest-performance-rust-vs-python/89686)._
