kiwix-js icon indicating copy to clipboard operation
kiwix-js copied to clipboard

Only load the zstd or xz decoders when needed

Open Jaifroid opened this issue 2 years ago • 2 comments

We currently load both zstd and xz decoders into memory when the app starts up. This increases the memory footprint of the app and is unnecessary (both have to be compiled by the asm or wasm engines, and memory has to be allocated to the Emscripten instance), whereas in practice no one ZIM ever has both types of compression.

There is no way to know the compression type of a specific ZIM until the app reads the header of a compressed cluster. Only at this point should the required decoder be loaded and instanitated.

Jaifroid avatar Jul 24 '21 16:07 Jaifroid

I wonder if this ticket still makes sense considering that we will follow the emscripten compiled libzim path?

kelson42 avatar Jun 26 '22 11:06 kelson42

Same reply as in #745. Once we have a version of libzim acting as our backend, we'll be able to close this as unneeded.

Jaifroid avatar Jun 26 '22 11:06 Jaifroid

Now that libzim is available as wasm and loaded here in kiwix-js, sounds possible to close it?!

kelson42 avatar Jan 09 '23 17:01 kelson42