mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-22 08:47:28 +01:00
Unroll the std/crc32 loop
name old speed new speed delta wuffs_crc32_ieee_10k/clang 2.30GB/s ± 1% 2.37GB/s ± 0% +3.31% (p=0.016 n=5+4) wuffs_crc32_ieee_100k/clang 2.30GB/s ± 0% 2.35GB/s ± 0% +2.39% (p=0.008 n=5+5) wuffs_crc32_ieee_10k/gcc 2.49GB/s ± 1% 2.72GB/s ± 0% +9.19% (p=0.008 n=5+5) wuffs_crc32_ieee_100k/gcc 2.50GB/s ± 0% 2.70GB/s ± 1% +8.18% (p=0.008 n=5+5) wuffs_gzip_decode_10k/clang 206MB/s ± 2% 207MB/s ± 0% ~ (p=1.000 n=5+5) wuffs_gzip_decode_100k/clang 231MB/s ± 2% 235MB/s ± 0% +1.57% (p=0.008 n=5+5) wuffs_gzip_decode_10k/gcc 234MB/s ± 0% 235MB/s ± 1% ~ (p=0.095 n=5+5) wuffs_gzip_decode_100k/gcc 267MB/s ± 0% 266MB/s ± 2% ~ (p=0.690 n=5+5)
This commit is contained in:
1 parent
a23681d1ba
commit
58cd282138
3 files changed
+118
-4
No files matched your search
+101
-1
@@ -2017,7 +2017,7 @@ uint32_t wuffs_crc32__ieee_hasher__update(wuffs_crc32__ieee_hasher* self,
|
||||
wuffs_base__slice_u8 i_slice_p = a_x;
|
||||
wuffs_base__slice_u8 v_p = i_slice_p;
|
||||
v_p.len = 8;
|
||||
uint8_t* i_end0_p = i_slice_p.ptr + (i_slice_p.len / 8) * 8;
|
||||
uint8_t* i_end0_p = i_slice_p.ptr + (i_slice_p.len / 64) * 64;
|
||||
while (v_p.ptr < i_end0_p) {
|
||||
v_s ^=
|
||||
((((uint32_t)(v_p.ptr[0])) << 0) | (((uint32_t)(v_p.ptr[1])) << 8) |
|
||||
@@ -2031,6 +2031,106 @@ uint32_t wuffs_crc32__ieee_hasher__update(wuffs_crc32__ieee_hasher* self,
|
||||
wuffs_crc32__ieee_table[6][255 & (v_s >> 8)] ^
|
||||
wuffs_crc32__ieee_table[7][255 & (v_s >> 0)]);
|
||||
v_p.ptr += 8;
|
||||
v_s ^=
|
||||
((((uint32_t)(v_p.ptr[0])) << 0) | (((uint32_t)(v_p.ptr[1])) << 8) |
|
||||
(((uint32_t)(v_p.ptr[2])) << 16) | (((uint32_t)(v_p.ptr[3])) << 24));
|
||||
v_s = (wuffs_crc32__ieee_table[0][v_p.ptr[7]] ^
|
||||
wuffs_crc32__ieee_table[1][v_p.ptr[6]] ^
|
||||
wuffs_crc32__ieee_table[2][v_p.ptr[5]] ^
|
||||
wuffs_crc32__ieee_table[3][v_p.ptr[4]] ^
|
||||
wuffs_crc32__ieee_table[4][255 & (v_s >> 24)] ^
|
||||
wuffs_crc32__ieee_table[5][255 & (v_s >> 16)] ^
|
||||
wuffs_crc32__ieee_table[6][255 & (v_s >> 8)] ^
|
||||
wuffs_crc32__ieee_table[7][255 & (v_s >> 0)]);
|
||||
v_p.ptr += 8;
|
||||
v_s ^=
|
||||
((((uint32_t)(v_p.ptr[0])) << 0) | (((uint32_t)(v_p.ptr[1])) << 8) |
|
||||
(((uint32_t)(v_p.ptr[2])) << 16) | (((uint32_t)(v_p.ptr[3])) << 24));
|
||||
v_s = (wuffs_crc32__ieee_table[0][v_p.ptr[7]] ^
|
||||
wuffs_crc32__ieee_table[1][v_p.ptr[6]] ^
|
||||
wuffs_crc32__ieee_table[2][v_p.ptr[5]] ^
|
||||
wuffs_crc32__ieee_table[3][v_p.ptr[4]] ^
|
||||
wuffs_crc32__ieee_table[4][255 & (v_s >> 24)] ^
|
||||
wuffs_crc32__ieee_table[5][255 & (v_s >> 16)] ^
|
||||
wuffs_crc32__ieee_table[6][255 & (v_s >> 8)] ^
|
||||
wuffs_crc32__ieee_table[7][255 & (v_s >> 0)]);
|
||||
v_p.ptr += 8;
|
||||
v_s ^=
|
||||
((((uint32_t)(v_p.ptr[0])) << 0) | (((uint32_t)(v_p.ptr[1])) << 8) |
|
||||
(((uint32_t)(v_p.ptr[2])) << 16) | (((uint32_t)(v_p.ptr[3])) << 24));
|
||||
v_s = (wuffs_crc32__ieee_table[0][v_p.ptr[7]] ^
|
||||
wuffs_crc32__ieee_table[1][v_p.ptr[6]] ^
|
||||
wuffs_crc32__ieee_table[2][v_p.ptr[5]] ^
|
||||
wuffs_crc32__ieee_table[3][v_p.ptr[4]] ^
|
||||
wuffs_crc32__ieee_table[4][255 & (v_s >> 24)] ^
|
||||
wuffs_crc32__ieee_table[5][255 & (v_s >> 16)] ^
|
||||
wuffs_crc32__ieee_table[6][255 & (v_s >> 8)] ^
|
||||
wuffs_crc32__ieee_table[7][255 & (v_s >> 0)]);
|
||||
v_p.ptr += 8;
|
||||
v_s ^=
|
||||
((((uint32_t)(v_p.ptr[0])) << 0) | (((uint32_t)(v_p.ptr[1])) << 8) |
|
||||
(((uint32_t)(v_p.ptr[2])) << 16) | (((uint32_t)(v_p.ptr[3])) << 24));
|
||||
v_s = (wuffs_crc32__ieee_table[0][v_p.ptr[7]] ^
|
||||
wuffs_crc32__ieee_table[1][v_p.ptr[6]] ^
|
||||
wuffs_crc32__ieee_table[2][v_p.ptr[5]] ^
|
||||
wuffs_crc32__ieee_table[3][v_p.ptr[4]] ^
|
||||
wuffs_crc32__ieee_table[4][255 & (v_s >> 24)] ^
|
||||
wuffs_crc32__ieee_table[5][255 & (v_s >> 16)] ^
|
||||
wuffs_crc32__ieee_table[6][255 & (v_s >> 8)] ^
|
||||
wuffs_crc32__ieee_table[7][255 & (v_s >> 0)]);
|
||||
v_p.ptr += 8;
|
||||
v_s ^=
|
||||
((((uint32_t)(v_p.ptr[0])) << 0) | (((uint32_t)(v_p.ptr[1])) << 8) |
|
||||
(((uint32_t)(v_p.ptr[2])) << 16) | (((uint32_t)(v_p.ptr[3])) << 24));
|
||||
v_s = (wuffs_crc32__ieee_table[0][v_p.ptr[7]] ^
|
||||
wuffs_crc32__ieee_table[1][v_p.ptr[6]] ^
|
||||
wuffs_crc32__ieee_table[2][v_p.ptr[5]] ^
|
||||
wuffs_crc32__ieee_table[3][v_p.ptr[4]] ^
|
||||
wuffs_crc32__ieee_table[4][255 & (v_s >> 24)] ^
|
||||
wuffs_crc32__ieee_table[5][255 & (v_s >> 16)] ^
|
||||
wuffs_crc32__ieee_table[6][255 & (v_s >> 8)] ^
|
||||
wuffs_crc32__ieee_table[7][255 & (v_s >> 0)]);
|
||||
v_p.ptr += 8;
|
||||
v_s ^=
|
||||
((((uint32_t)(v_p.ptr[0])) << 0) | (((uint32_t)(v_p.ptr[1])) << 8) |
|
||||
(((uint32_t)(v_p.ptr[2])) << 16) | (((uint32_t)(v_p.ptr[3])) << 24));
|
||||
v_s = (wuffs_crc32__ieee_table[0][v_p.ptr[7]] ^
|
||||
wuffs_crc32__ieee_table[1][v_p.ptr[6]] ^
|
||||
wuffs_crc32__ieee_table[2][v_p.ptr[5]] ^
|
||||
wuffs_crc32__ieee_table[3][v_p.ptr[4]] ^
|
||||
wuffs_crc32__ieee_table[4][255 & (v_s >> 24)] ^
|
||||
wuffs_crc32__ieee_table[5][255 & (v_s >> 16)] ^
|
||||
wuffs_crc32__ieee_table[6][255 & (v_s >> 8)] ^
|
||||
wuffs_crc32__ieee_table[7][255 & (v_s >> 0)]);
|
||||
v_p.ptr += 8;
|
||||
v_s ^=
|
||||
((((uint32_t)(v_p.ptr[0])) << 0) | (((uint32_t)(v_p.ptr[1])) << 8) |
|
||||
(((uint32_t)(v_p.ptr[2])) << 16) | (((uint32_t)(v_p.ptr[3])) << 24));
|
||||
v_s = (wuffs_crc32__ieee_table[0][v_p.ptr[7]] ^
|
||||
wuffs_crc32__ieee_table[1][v_p.ptr[6]] ^
|
||||
wuffs_crc32__ieee_table[2][v_p.ptr[5]] ^
|
||||
wuffs_crc32__ieee_table[3][v_p.ptr[4]] ^
|
||||
wuffs_crc32__ieee_table[4][255 & (v_s >> 24)] ^
|
||||
wuffs_crc32__ieee_table[5][255 & (v_s >> 16)] ^
|
||||
wuffs_crc32__ieee_table[6][255 & (v_s >> 8)] ^
|
||||
wuffs_crc32__ieee_table[7][255 & (v_s >> 0)]);
|
||||
v_p.ptr += 8;
|
||||
}
|
||||
v_p.len = 8;
|
||||
uint8_t* i_end1_p = i_slice_p.ptr + (i_slice_p.len / 8) * 8;
|
||||
while (v_p.ptr < i_end1_p) {
|
||||
v_s ^=
|
||||
((((uint32_t)(v_p.ptr[0])) << 0) | (((uint32_t)(v_p.ptr[1])) << 8) |
|
||||
(((uint32_t)(v_p.ptr[2])) << 16) | (((uint32_t)(v_p.ptr[3])) << 24));
|
||||
v_s = (wuffs_crc32__ieee_table[0][v_p.ptr[7]] ^
|
||||
wuffs_crc32__ieee_table[1][v_p.ptr[6]] ^
|
||||
wuffs_crc32__ieee_table[2][v_p.ptr[5]] ^
|
||||
wuffs_crc32__ieee_table[3][v_p.ptr[4]] ^
|
||||
wuffs_crc32__ieee_table[4][255 & (v_s >> 24)] ^
|
||||
wuffs_crc32__ieee_table[5][255 & (v_s >> 16)] ^
|
||||
wuffs_crc32__ieee_table[6][255 & (v_s >> 8)] ^
|
||||
wuffs_crc32__ieee_table[7][255 & (v_s >> 0)]);
|
||||
v_p.ptr += 8;
|
||||
}
|
||||
v_p.len = 1;
|
||||
uint8_t* i_end2_p = i_slice_p.ptr + i_slice_p.len;
|
||||
|
||||
Reference in new issue
Block a user