mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 08:38:14 +01:00
Allow p[i] for ptr-typed p; speed up std/crc32
name old speed new speed delta wuffs_crc32_ieee_10k/clang 483MB/s ± 1% 2263MB/s ± 3% +368.94% (p=0.000 n=48+5) wuffs_crc32_ieee_100k/clang 482MB/s ± 1% 2257MB/s ± 3% +367.96% (p=0.000 n=48+5) wuffs_crc32_ieee_10k/gcc 419MB/s ± 1% 2473MB/s ± 1% +489.93% (p=0.000 n=48+5) wuffs_crc32_ieee_100k/gcc 419MB/s ± 1% 2465MB/s ± 1% +488.02% (p=0.000 n=47+5) wuffs_gzip_decode_10k/clang 153MB/s ± 1% 208MB/s ± 0% +35.30% (p=0.000 n=48+5) wuffs_gzip_decode_100k/clang 168MB/s ± 1% 236MB/s ± 0% +40.67% (p=0.000 n=50+4) wuffs_gzip_decode_10k/gcc 156MB/s ± 1% 231MB/s ± 3% +47.91% (p=0.000 n=50+5) wuffs_gzip_decode_100k/gcc 172MB/s ± 1% 267MB/s ± 0% +55.64% (p=0.000 n=48+5)
This commit is contained in:
1 parent
e72f957eca
commit
f64bf4af61
7 files changed
+35
-11
No files matched your search
@@ -28,8 +28,19 @@ pub func ieee_hasher.update(x slice base.u8)(checksum base.u32) {
|
||||
var s base.u32 = 0xFFFFFFFF ^ this.state
|
||||
|
||||
iterate (step:8, unroll:1)(p ptr base.u8:in.x) {
|
||||
// TODO: bounds checking for the ptr base.u8 methods.
|
||||
// TODO: explain the slicing-by-8 algorithm.
|
||||
//
|
||||
// TODO: bounds checking for the ptr base.u8 methods and the index
|
||||
// expressions "p[7]" etc.
|
||||
s ^= p.read_u32le(at:0)
|
||||
s = ieee_table[0][p[7]] ^
|
||||
ieee_table[1][p[6]] ^
|
||||
ieee_table[2][p[5]] ^
|
||||
ieee_table[3][p[4]] ^
|
||||
ieee_table[4][0xFF & (s >> 24)] ^
|
||||
ieee_table[5][0xFF & (s >> 16)] ^
|
||||
ieee_table[6][0xFF & (s >> 8)] ^
|
||||
ieee_table[7][0xFF & (s >> 0)]
|
||||
} else {
|
||||
s = ieee_table[0][((s & 0xFF) as base.u8) ^ deref p] ^ (s >> 8)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user