std/crc64: optimize for x86+SSE4.2

name                           old speed      new speed      delta

wuffs_crc64_ecma_10k/clang14   1.78GB/s ± 0%  5.79GB/s ± 0%  +225.48%  (p=0.008 n=5+5)
wuffs_crc64_ecma_100k/clang14  1.78GB/s ± 0%  6.09GB/s ± 0%  +241.67%  (p=0.008 n=5+5)

wuffs_crc64_ecma_10k/gcc12     2.05GB/s ± 1%  5.79GB/s ± 1%  +182.80%  (p=0.008 n=5+5)
wuffs_crc64_ecma_100k/gcc12    2.01GB/s ± 0%  6.09GB/s ± 0%  +202.64%  (p=0.008 n=5+5)

wuffs_xz_decode_100k/clang14   57.9MB/s ± 1%  60.2MB/s ± 0%    +4.11%  (p=0.008 n=5+5)

wuffs_xz_decode_100k/gcc12     57.0MB/s ± 0%  57.8MB/s ± 1%    +1.39%  (p=0.008 n=5+5)

$ time example-mzcat < linux-6.8.2.tar.xz > /dev/null
Before: user 0m8.122s
After:  user 0m8.115s
This commit is contained in:
Nigel Tao committed 2024-04-02 00:17:43 +11:00
1 parent 5c693c9de8
commit f32bfe95c6
5 files changed
+466 -24

No files matched your search

+15 -5
View File
@@ -21,6 +21,21 @@ pub func ecma_hasher.set_quirk!(key: base.u32, value: base.u64) base.status {
}
pub func ecma_hasher.update!(x: roslice base.u8) {
if this.state == 0 {
choose up = [
up_x86_sse42]
}
this.up!(x: args.x)
}
pub func ecma_hasher.update_u64!(x: roslice base.u8) base.u64 {
this.update!(x: args.x)
return this.checksum_u64()
}
pri func ecma_hasher.up!(x: roslice base.u8),
choosy,
{
var s : base.u64
var p : roslice base.u8
@@ -51,11 +66,6 @@ pub func ecma_hasher.update!(x: roslice base.u8) {
this.state = 0xFFFF_FFFF_FFFF_FFFF ^ s
}
pub func ecma_hasher.update_u64!(x: roslice base.u8) base.u64 {
this.update!(x: args.x)
return this.checksum_u64()
}
pub func ecma_hasher.checksum_u64() base.u64 {
return this.state
}