github.com/vc42/parquet-go@v0.0.0-20240320194221-1a9adb5f23f5/internal/bytealg/count_amd64.go (about) 1 //go:build !purego 2 3 package bytealg 4 5 // This function is similar to using the standard bytes.Count function with a 6 // one-byte separator. However, the implementation makes use of AVX-512 when 7 // possible, which yields measurable throughput improvements: 8 // 9 // name old time/op new time/op delta 10 // CountByte 82.5ns ± 0% 43.9ns ± 0% -46.74% (p=0.000 n=10+10) 11 // 12 // name old speed new speed delta 13 // CountByte 49.6GB/s ± 0% 93.2GB/s ± 0% +87.74% (p=0.000 n=10+10) 14 // 15 // 16 // On systems that do not have AVX-512, the AVX2 version of the code is also 17 // optimized to make use of multiple register lanes, which gives a bit better 18 // throughput than the standard library function: 19 // 20 // name old time/op new time/op delta 21 // CountByte 82.5ns ± 0% 61.0ns ± 0% -26.04% (p=0.000 n=10+10) 22 // 23 // name old speed new speed delta 24 // CountByte 49.6GB/s ± 0% 67.1GB/s ± 0% +35.21% (p=0.000 n=10+10) 25 // 26 // 27 //go:noescape 28 func Count(data []byte, value byte) int