-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
5 changed files
with
466 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
// Copyright 2024 The Wuffs Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
//go:build ignore | ||
// +build ignore | ||
|
||
package main | ||
|
||
// print-crc64-x86-sse42-magic-numbers.go prints the std/crc64 | ||
// ECMA_X86_SSE42_ETC magic number tables. | ||
// | ||
// It is like print-crc32-x86-sse42-magic-numbers.go but for CRC-64/ECMA, not | ||
// CRC-32/IEEE. | ||
// | ||
// Usage: go run print-crc64-x86-sse42-magic-numbers.go | ||
// | ||
// Output: | ||
// Px' = 0x92D8_AF2B_AF0E_1E85 | ||
// k1' = 0xE05D_D497_CA39_3AE4 | ||
// k2' = 0xDABE_95AF_C787_5F40 | ||
// μ' = 0x9C3E_466C_1729_63D5 | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
// px is the P(x) polynomial, a bit-reversal (with explicit high bit) of the | ||
// CRC-64/ECMA polynomial sometimes written as 0xC96C_5795_D787_0F42. | ||
// P(x) = 0x1_42F0_E1EB_A9EA_3693 | ||
// P(x) = 0b1_01000010_11110000_11100001_11101011_10101001_11101010_00110110_10010011 | ||
const px = "10100001011110000111000011110101110101001111010100011011010010011" | ||
|
||
var spaces = strings.Repeat(" ", 1024) | ||
|
||
func debugf(format string, a ...interface{}) { | ||
if false { // Change false to true to show the long divisions. | ||
fmt.Printf(format, a...) | ||
} | ||
} | ||
|
||
func show(name string, value string) { | ||
v := uint64(0) | ||
if strings.Contains(name, "'") { | ||
for i := len(value) - 1; i >= 0; i-- { | ||
v = (v << 1) | uint64(value[i]&1) | ||
} | ||
} else { | ||
for i := 0; i < len(value); i++ { | ||
v = (v << 1) | uint64(value[i]&1) | ||
} | ||
} | ||
fmt.Printf("%s = 0x%04X_%04X_%04X_%04X\n", name, | ||
0xFFFF&(v>>48), 0xFFFF&(v>>32), 0xFFFF&(v>>16), 0xFFFF&(v>>0)) | ||
} | ||
|
||
func calcKn(name string, power int) { | ||
numerator := "1" + strings.Repeat("0", power) | ||
b := []byte(numerator) | ||
i := 0 | ||
debugf(" %s\n", numerator) | ||
for i+len(px) <= len(numerator) { | ||
for j := 0; j < len(px); j++ { | ||
b[i+j] ^= 1 & px[j] | ||
} | ||
debugf(" %s%s\n", spaces[:i], px) | ||
for ; (i < len(b)) && (b[i] == '0'); i++ { | ||
b[i] = ' ' | ||
} | ||
debugf(" %s\n", b) | ||
} | ||
show(name, string(b[len(b)-len(px):])) | ||
} | ||
|
||
func calcMu(name string) { | ||
numerator := "1" + strings.Repeat("0", 128) | ||
mu := make([]byte, 129) | ||
b := []byte(numerator) | ||
i := 0 | ||
debugf(" %s\n", numerator) | ||
for i+len(px) <= len(numerator) { | ||
for j := 0; j < len(px); j++ { | ||
b[i+j] ^= 1 & px[j] | ||
} | ||
debugf(" %s%s\n", spaces[:i], px) | ||
b[i] = ':' | ||
mu[i] = '1' | ||
i++ | ||
for ; (i < len(b)) && (b[i] == '0'); i++ { | ||
b[i] = ' ' | ||
mu[i] = '0' | ||
} | ||
debugf(" %s\n", b) | ||
} | ||
show(name, string(mu[:65])) | ||
} | ||
|
||
func main() { | ||
show("Px'", px) | ||
calcKn("k1'", 128+64) | ||
calcKn("k2'", 128) | ||
calcMu("μ' ") | ||
} |
Oops, something went wrong.