mrhooray / crc-rs

Rust implementation of CRC(16, 32, 64) with support of various standards
Apache License 2.0
187 stars 49 forks source link

Add crc16 slice-by-16 and no-table implementations #89

Closed KillingSpark closed 1 year ago

KillingSpark commented 1 year ago

Same old stuff for u16. Second to last 🙏

Benches (this time on a Mac):

crc16/default           time:   [41.595 µs 41.660 µs 41.730 µs]
                        thrpt:  [374.43 MiB/s 375.06 MiB/s 375.65 MiB/s]

crc16/nolookup          time:   [189.08 µs 189.20 µs 189.31 µs]
                        thrpt:  [82.534 MiB/s 82.586 MiB/s 82.636 MiB/s]

crc16/bytewise          time:   [41.532 µs 41.567 µs 41.609 µs]
                        thrpt:  [375.52 MiB/s 375.90 MiB/s 376.22 MiB/s]

crc16/slice16           time:   [4.7172 µs 4.7269 µs 4.7378 µs]
                        thrpt:  [3.2206 GiB/s 3.2281 GiB/s 3.2347 GiB/s]
akhilles commented 1 year ago

Nice! That's a huge performance win, >11x on my machine

crc16/bytewise          time:   [31.785 µs 31.800 µs 31.818 µs]
                        thrpt:  [491.08 MiB/s 491.36 MiB/s 491.58 MiB/s]
crc16/slice16           time:   [2.7479 µs 2.7502 µs 2.7539 µs]
                        thrpt:  [5.5408 GiB/s 5.5483 GiB/s 5.5529 GiB/s]