MCPcopy
hub / github.com/klauspost/compress / predefinedFSEInputs

Function predefinedFSEInputs

zstd/fse_decoder_bench_test.go:9–35  ·  view source on GitHub ↗

predefinedFSEInputs returns the three RFC default distributions (litLength, offset, matchLength) as fseDecoders, ready for buildDtable. Defined without build constraints so the benchmark can run under both the asm and -tags noasm (pure-Go) builds for an apples-to-apples comparison.

()

Source from the content-addressed store, hash-verified

7// Defined without build constraints so the benchmark can run under both the
8// asm and -tags noasm (pure-Go) builds for an apples-to-apples comparison.
9func predefinedFSEInputs() map[string]func() *fseDecoder {
10 return map[string]func() *fseDecoder{
11 "litLength": func() *fseDecoder {
12 s := &fseDecoder{actualTableLog: 6, symbolLen: 36}
13 copy(s.norm[:], []int16{4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1,
14 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 1, 1, 1, 1, 1,
15 -1, -1, -1, -1})
16 return s
17 },
18 "offset": func() *fseDecoder {
19 s := &fseDecoder{actualTableLog: 5, symbolLen: 29}
20 copy(s.norm[:], []int16{
21 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
22 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1})
23 return s
24 },
25 "matchLength": func() *fseDecoder {
26 s := &fseDecoder{actualTableLog: 6, symbolLen: 53}
27 copy(s.norm[:], []int16{
28 1, 4, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
29 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
30 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1,
31 -1, -1, -1, -1, -1})
32 return s
33 },
34 }
35}
36
37func BenchmarkBuildDtable(b *testing.B) {
38 for name, mk := range predefinedFSEInputs() {

Callers 2

BenchmarkBuildDtableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…