| author | |
| committer | |
| log | 61e9e82bdc10110b74bdeb973cc542c7b73a4ae2 |
| tree | f60c7e2f6b97395dee7602d90ce774f19e01e47e |
| parent | 5e50d145d964238a68d4780e253d26431e7c7994 |
Speed up a little the slicing-by-8 code path by replacing the
(load+shift+xor)*4 sequence with a single u32 load plus a xor.
Before:
```
iterative: 1018 MiB/s [000000006c3b110d]
small keys: 1075 MiB/s [0035bf3dcac00000]
```
After:
```
iterative: 1114 MiB/s [000000006c3b110d]
small keys: 1324 MiB/s [0035bf3dcac00000]
```1 files changed, 1 insertions(+), 4 deletions(-)
lib/std/hash/crc.zig+1-4| ... | ... | @@ -71,10 +71,7 @@ pub fn Crc32WithPoly(comptime poly: Polynomial) type { |
| 71 | 71 | const p = input[i .. i + 8]; |
| 72 | 72 | |
| 73 | 73 | // Unrolling this way gives ~50Mb/s increase |
| 74 | self.crc ^= (@as(u32, p[0]) << 0); | |
| 75 | self.crc ^= (@as(u32, p[1]) << 8); | |
| 76 | self.crc ^= (@as(u32, p[2]) << 16); | |
| 77 | self.crc ^= (@as(u32, p[3]) << 24); | |
| 74 | self.crc ^= std.mem.readIntLittle(u32, p[0..4]); | |
| 78 | 75 | |
| 79 | 76 | self.crc = |
| 80 | 77 | lookup_tables[0][p[7]] ^ |