-
Notifications
You must be signed in to change notification settings - Fork 21
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
Simplify example. Fixes #29. #30
Conversation
I don't know... it's certainly more concise, but it's hiding a lot of performance cost. I'm worried about sucking people into a slow pattern. I will try to do some actual measurements and get back to you. |
Show both then. With the simple one first. |
If the performance is very different, maybe we need some higher level APIs: function compressArrayBuffer(input) {
return ReadableStream.from(input)
.pipeThrough(new CompressionStream('deflate'))
.arrayBuffer();
} |
Yes, this is a combination of whatwg/streams#1018 and whatwg/streams#1019. |
For compressing 50KB, the version using Blob is over 10 times slower in Chrome 80.0.3987.106:
Could you retain the existing implementation under the new implementation, marked "(verbose but high-performance version)" or similar? |
Whoa, any idea where the overhead comes from? The conversion to blob, or to response? |
Makes me wonder if https://github.com/wicg/compression/blob/master/explainer.md#gzip-decompress-a-blob-to-a-blob is similarly slow, and makes even more of a case for the high-level methods. |
Blob, because it involves the browser process. If you use the Response constructor to convert-to-stream instead, it's only twice as slow. |
There's an implicit assumption in this example that you're using a Blob because your data is huge. Maybe we should add an explicit note that this will perform poorly for "small" data. |
Interesting! I've changed the PR to use Response rather than Blob. |
Thanks. I'd still like to add some guidance in how to do it performantly, but I can do that in a follow-up change. |
Thanks for looking into the performance characteristics! I learned a lot. |
Hi 👋 |
See https://bugs.chromium.org/p/chromium/issues/detail?id=1053486#c1 for some background. |
No description provided.