From 5336b511e03b6166e6c2b8eed260e4d2b3fc1ae5 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Fri, 6 Oct 2023 14:16:21 +1100 Subject: [PATCH] std/xxhash32: add SIMD comment --- std/xxhash32/common_xxhash32.wuffs | 6 ++++++ std/xxhash64/common_xxhash64.wuffs | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/std/xxhash32/common_xxhash32.wuffs b/std/xxhash32/common_xxhash32.wuffs index 47398430..1c515c95 100644 --- a/std/xxhash32/common_xxhash32.wuffs +++ b/std/xxhash32/common_xxhash32.wuffs @@ -49,8 +49,14 @@ pub func hasher.update!(x: roslice base.u8) { this.v1 = INITIAL_V1 this.v2 = INITIAL_V2 this.v3 = INITIAL_V3 + + // In theory, we could "choose up" here to pick SIMD versions. In + // practice, non-SIMD versions are faster (and simpler). For example, + // see commit b9b28dbe "std/xxhash32: add hasher.up_x86_sse42". } + // Slicing at 0x100_0000 is arbitrary but ensures that the subslice's + // length (used in hasher.up) doesn't overflow a u32. while args.x.length() > 0 { remaining = args.x[.. 0] if args.x.length() > 0x100_0000 { diff --git a/std/xxhash64/common_xxhash64.wuffs b/std/xxhash64/common_xxhash64.wuffs index 7047fcc4..0d2c0d0d 100644 --- a/std/xxhash64/common_xxhash64.wuffs +++ b/std/xxhash64/common_xxhash64.wuffs @@ -48,6 +48,10 @@ pub func hasher.update!(x: roslice base.u8) { this.v1 = INITIAL_V1 this.v2 = INITIAL_V2 this.v3 = INITIAL_V3 + + // In theory, we could "choose up" here to pick SIMD versions. In + // practice, non-SIMD versions are faster (and simpler). For example, + // see commit b9b28dbe "std/xxhash32: add hasher.up_x86_sse42". } this.up!(x: args.x)