Skip to content

Commit

Permalink
clarify asynchronous delay in README
Browse files Browse the repository at this point in the history
  • Loading branch information
101arrowz committed Dec 14, 2021
1 parent 9110b06 commit e9ebdc2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -367,7 +367,7 @@ unzipper.push(zipChunk3, true);

As you may have guessed, there is an asynchronous version of every method as well. Unlike most libraries, this will cause the compression or decompression run in a separate thread entirely and automatically by using Web (or Node) Workers (as of now, Deno is unsupported). This means that the processing will not block the main thread at all.

Note that there is a significant initial overhead to using workers of about 70ms, so it's best to avoid the asynchronous API unless necessary. However, if you're compressing multiple large files at once, or the synchronous API causes the main thread to hang for too long, the callback APIs are an order of magnitude better.
Note that there is a significant initial overhead to using workers of about 70ms for each asynchronous function. For instance, if you call `unzip` ten times, the overhead only applies for the first call, but if you call `unzip` and `zlib`, they will each cause the 70ms delay. Therefore, it's best to avoid the asynchronous API unless necessary. However, if you're compressing multiple large files at once, or the synchronous API causes the main thread to hang for too long, the callback APIs are an order of magnitude better.
```js
import {
gzip, zlib, AsyncGzip, zip, unzip, strFromU8,
Expand Down

0 comments on commit e9ebdc2

Please sign in to comment.