Skip to content

Not competitive with xxh and other algorithms #2

Description

@vlovich

Despite what smhasher indicates, the Rust version isn't able to get anywhere near that level of performance. I benchmarked with rust 1.72 on Linux 6.5 and a 13900 with varying key sizes:

umash64/4               time:   [18.884 ns 18.960 ns 19.038 ns]
                        thrpt:  [200.38 MiB/s 201.20 MiB/s 202.01 MiB/s]
umash64/100             time:   [41.217 ns 41.407 ns 41.603 ns]
                        thrpt:  [2.2386 GiB/s 2.2492 GiB/s 2.2596 GiB/s]
umash64/64000           time:   [1.5422 µs 1.5494 µs 1.5571 µs]
                        thrpt:  [38.280 GiB/s 38.470 GiB/s 38.649 GiB/s]
umash128/4              time:   [20.927 ns 21.042 ns 21.162 ns]
                        thrpt:  [180.26 MiB/s 181.29 MiB/s 182.29 MiB/s]
umash128/100            time:   [45.772 ns 45.915 ns 46.086 ns]
                        thrpt:  [2.0208 GiB/s 2.0284 GiB/s 2.0347 GiB/s]
umash128/64000          time:   [2.6298 µs 2.6457 µs 2.6623 µs]
                        thrpt:  [22.389 GiB/s 22.529 GiB/s 22.665 GiB/s]

It takes quite large data for umash to get to peak performance (didn't test data beyond 64kb) and even then the performance isn't up to snuff as the native Rust xxhash-rust crate:

xxh3-64/4               time:   [1.3894 ns 1.3919 ns 1.3945 ns]
                        thrpt:  [2.6713 GiB/s 2.6765 GiB/s 2.6813 GiB/s]
xxh3-64/100             time:   [3.2518 ns 3.2560 ns 3.2612 ns]
                        thrpt:  [28.558 GiB/s 28.603 GiB/s 28.640 GiB/s]
xxh3-64/64000           time:   [1.0922 µs 1.1007 µs 1.1094 µs]
                        thrpt:  [53.727 GiB/s 54.150 GiB/s 54.573 GiB/s]
xxh3-128/4              time:   [1.7857 ns 1.7994 ns 1.8146 ns]
                        thrpt:  [2.0530 GiB/s 2.0703 GiB/s 2.0862 GiB/s]
xxh3-128/100            time:   [4.8149 ns 4.8217 ns 4.8304 ns]
                        thrpt:  [19.280 GiB/s 19.315 GiB/s 19.343 GiB/s]
xxh3-128/64000          time:   [1.1099 µs 1.1181 µs 1.1265 µs]
                        thrpt:  [52.912 GiB/s 53.309 GiB/s 53.703 GiB/s]

Performance for xxh3-64/128 seems to converge between 100 and 500 bytes.

According to smhasher, umash should only be ~1.4x slower than xxh3 for small keys and on par for ~250kib keys which makes me think the discrepancy here comes from ffi or having a stale version of the C code.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions