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

compression-api #1230

Merged
merged 3 commits into from
Aug 20, 2024
Merged

compression-api #1230

merged 3 commits into from
Aug 20, 2024

Conversation

arose
Copy link
Member

@arose arose commented Aug 18, 2024

  • Use CompressionStream Browser API when available

// inflating a 44 MB gzip file to 225 MB.

// Using JS
// inflate: 570.8759765625 ms
// inflate: 562.950927734375 ms
// inflate: 595.06591796875 ms
// inflate: 584.8740234375 ms
// inflate: 583.31396484375 ms

// Using DecompressionStream
// inflate: 502.001953125 ms
// inflate: 476.818115234375 ms
// inflate: 476.68701171875 ms
// inflate: 422.319091796875 ms
// inflate: 428.925048828125 ms

closes #580

@arose arose requested a review from dsehnal August 18, 2024 02:21
@arose arose added the enhancement New feature or request label Aug 18, 2024
Copy link
Member

@dsehnal dsehnal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Comment on lines 10 to 14
let hasCompressionStreamSupport: boolean | undefined = undefined;
export function checkCompressionStreamSupport(format: 'deflate' | 'deflate-raw' | 'gzip'): boolean {
if (hasCompressionStreamSupport === undefined) {
try {
new CompressionStream(format);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could only some formats be supported? Because if so, there is a bug.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ouch

@arose arose merged commit 051beb3 into master Aug 20, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use fflate (or browser built-in) for gzip/zip compression/decompression
2 participants