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.
()
| 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. |
| 9 | func 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 | |
| 37 | func BenchmarkBuildDtable(b *testing.B) { |
| 38 | for name, mk := range predefinedFSEInputs() { |
no outgoing calls
no test coverage detected
searching dependent graphs…