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:
Nigel Tao committed 2018-05-04 11:59:48 +10:00
1 parent e72f957eca
commit f64bf4af61
7 files changed
+35 -11

No files matched your search

+9 -1
View File
@@ -2016,9 +2016,17 @@ uint32_t wuffs_crc32__ieee_hasher__update(wuffs_crc32__ieee_hasher* self,
{
wuffs_base__slice_u8 i_slice_p = a_x;
uint8_t* v_p = i_slice_p.ptr;
uint8_t* i_end0_p = i_slice_p.ptr + (i_slice_p.len / 8) * 0;
uint8_t* i_end0_p = i_slice_p.ptr + (i_slice_p.len / 8) * 8;
while (v_p < i_end0_p) {
v_s ^= (wuffs_base__load_u32le(v_p + 0));
v_s = (wuffs_crc32__ieee_table[0][v_p[7]] ^
wuffs_crc32__ieee_table[1][v_p[6]] ^
wuffs_crc32__ieee_table[2][v_p[5]] ^
wuffs_crc32__ieee_table[3][v_p[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 += 8;
}
uint8_t* i_end1_p = i_slice_p.ptr + i_slice_p.len;