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

s2: Avoid Decode size checks #328

Merged
merged 1 commit into from
Mar 2, 2021
Merged

s2: Avoid Decode size checks #328

merged 1 commit into from
Mar 2, 2021

Conversation

klauspost
Copy link
Owner

Add another decode loop that doesn't check sizes as long as src is big enough.

For now only in Go version.

Streams:

Before: Decompressing. 426243297 -> 1000000000 [234.61%]; 1.941s, 491.3MB/s
After:  Decompressing. 426243297 -> 1000000000 [234.61%]; 1.895s, 503.3MB/s

Some blocks like it a lot:

BenchmarkDecodeS2Block/4-pdf/block-32                      379           336           -11.35%
BenchmarkDecodeS2Block/4-pdf/block-better-32               691           630           -8.83%
BenchmarkDecodeS2Block/4-pdf/block-best-32                 816           702           -13.97%
BenchmarkDecodeS2Block/5-html4/block-32                    13645         8727          -36.04%
BenchmarkDecodeS2Block/5-html4/block-better-32             14059         9204          -34.53%
BenchmarkDecodeS2Block/5-html4/block-best-32               13729         8975          -34.63%

Add another decode loop that doesn't check sizes as long as src is big enough.

For now only in Go version.

Streams:
```
Before: Decompressing. 426243297 -> 1000000000 [234.61%]; 1.941s, 491.3MB/s
After:  Decompressing. 426243297 -> 1000000000 [234.61%]; 1.895s, 503.3MB/s
```

Some blocks like it a lot:
```
BenchmarkDecodeS2Block/4-pdf/block-32                      379           336           -11.35%
BenchmarkDecodeS2Block/4-pdf/block-better-32               691           630           -8.83%
BenchmarkDecodeS2Block/4-pdf/block-best-32                 816           702           -13.97%
BenchmarkDecodeS2Block/5-html4/block-32                    13645         8727          -36.04%
BenchmarkDecodeS2Block/5-html4/block-better-32             14059         9204          -34.53%
BenchmarkDecodeS2Block/5-html4/block-best-32               13729         8975          -34.63%
```
@klauspost klauspost merged commit 0d78ef0 into master Mar 2, 2021
@klauspost klauspost deleted the s2-decode-size-checks branch March 2, 2021 11:34
klauspost added a commit to klauspost/minio that referenced this pull request Mar 10, 2021
Relevant updates:

* Less allocations on decode: klauspost/compress#322
* Fixed rare out-of-bounds write on amd64.
* ARM64 decompression assembly. Around 2x output speed. klauspost/compress#324
* Speed up decompression on non-assembly platforms. klauspost/compress#328

Upgrade cpuid to match simdjson.
harshavardhana pushed a commit to minio/minio that referenced this pull request Mar 10, 2021
Relevant updates:

* Less allocations on decode: klauspost/compress#322
* Fixed rare out-of-bounds write on amd64.
* ARM64 decompression assembly. Around 2x output speed. klauspost/compress#324
* Speed up decompression on non-assembly platforms. klauspost/compress#328

Upgrade cpuid to match simdjson.
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.

None yet

1 participant