Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flate: Improve huffman generation speed ~5% faster #490

Merged
merged 1 commit into from
Feb 5, 2022

Conversation

klauspost
Copy link
Owner

@klauspost klauspost commented Feb 5, 2022

Mainly gains for small blocks & fastest levels.

benchmark                               old ns/op     new ns/op     delta
BenchmarkEncodeDigitsConstant1e4-32     16080         15984         -0.60%
BenchmarkEncodeDigitsSpeed1e4-32        48105         45890         -4.60%
BenchmarkEncodeDigitsDefault1e4-32      114016        111234        -2.44%
BenchmarkEncodeDigitsCompress1e4-32     228570        225041        -1.54%
BenchmarkEncodeDigitsSL1e4-32           46695         45006         -3.62%
BenchmarkEncodeTwainConstant1e4-32      23557         22033         -6.47%
BenchmarkEncodeTwainSpeed1e4-32         68594         63177         -7.90%
BenchmarkEncodeTwainDefault1e4-32       112498        111798        -0.62%
BenchmarkEncodeTwainCompress1e4-32      282909        274804        -2.86%
BenchmarkEncodeTwainSL1e4-32            68406         62362         -8.84%

benchmark                               old MB/s     new MB/s     speedup
BenchmarkEncodeDigitsConstant1e4-32     621.89       625.64       1.01x
BenchmarkEncodeDigitsSpeed1e4-32        207.88       217.91       1.05x
BenchmarkEncodeDigitsDefault1e4-32      87.71        89.90        1.02x
BenchmarkEncodeDigitsCompress1e4-32     43.75        44.44        1.02x
BenchmarkEncodeDigitsSL1e4-32           214.16       222.19       1.04x
BenchmarkEncodeTwainConstant1e4-32      424.51       453.87       1.07x
BenchmarkEncodeTwainSpeed1e4-32         145.79       158.29       1.09x
BenchmarkEncodeTwainDefault1e4-32       88.89        89.45        1.01x
BenchmarkEncodeTwainCompress1e4-32      35.35        36.39        1.03x
BenchmarkEncodeTwainSL1e4-32            146.19       160.35       1.10x

(output is byte exact)

Mainly gains for small blocks:

```
benchmark                               old ns/op     new ns/op     delta
BenchmarkEncodeDigitsConstant1e4-32     16080         15984         -0.60%
BenchmarkEncodeDigitsSpeed1e4-32        48105         45890         -4.60%
BenchmarkEncodeDigitsDefault1e4-32      114016        111234        -2.44%
BenchmarkEncodeDigitsCompress1e4-32     228570        225041        -1.54%
BenchmarkEncodeDigitsSL1e4-32           46695         45006         -3.62%
BenchmarkEncodeTwainConstant1e4-32      23557         22033         -6.47%
BenchmarkEncodeTwainSpeed1e4-32         68594         63177         -7.90%
BenchmarkEncodeTwainDefault1e4-32       112498        111798        -0.62%
BenchmarkEncodeTwainCompress1e4-32      282909        274804        -2.86%
BenchmarkEncodeTwainSL1e4-32            68406         62362         -8.84%

benchmark                               old MB/s     new MB/s     speedup
BenchmarkEncodeDigitsConstant1e4-32     621.89       625.64       1.01x
BenchmarkEncodeDigitsSpeed1e4-32        207.88       217.91       1.05x
BenchmarkEncodeDigitsDefault1e4-32      87.71        89.90        1.02x
BenchmarkEncodeDigitsCompress1e4-32     43.75        44.44        1.02x
BenchmarkEncodeDigitsSL1e4-32           214.16       222.19       1.04x
BenchmarkEncodeTwainConstant1e4-32      424.51       453.87       1.07x
BenchmarkEncodeTwainSpeed1e4-32         145.79       158.29       1.09x
BenchmarkEncodeTwainDefault1e4-32       88.89        89.45        1.01x
BenchmarkEncodeTwainCompress1e4-32      35.35        36.39        1.03x
BenchmarkEncodeTwainSL1e4-32            146.19       160.35       1.10x
```
@klauspost klauspost merged commit 43829fc into master Feb 5, 2022
@klauspost klauspost deleted the flate-improve-bitcount branch February 5, 2022 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant