Code Monkey home page Code Monkey logo

Comments (2)

mgautierfr avatar mgautierfr commented on September 16, 2024 1

A solution may be to cache the partially decompressed cluster together with the current state of the decompression. Then, if/when a blob from the not-yet-decompressed portion of the cluster is later needed, decompression can be performed incrementally from the point at which it was previously suspended.

It is a tricky thing to do (while possible) :

  • We don't want to invalidate the cache. So we must not reallocate the already decompressed data. It means that we must do a partial decompression to read the offsets and be able to get the total size, allocate a buffer for this size and then do another partial decompression (until the article to read) in this buffer. It would totally interleave the functionality of decompressing the content and reading it (where it is two different paths now)
  • We have to check every time we want to access a blob in the cluster that the data has been actually uncompressed. Every access to the data must lead to a decompression and a modification of the buffer. It means that this should be thread safe as several threads may access the cluster in the same time.
  • Storing the decompression state means storing the decompression stream (lzma_stream, z_stream or ZSTD_[CD]Stream) and maybe the compressed data (or we may have to do some complex synchronization to load the data later (to investigate)).

This is not a easy task. And I'm not sure we need it. At least we should do some measurement to be sure it worth it (especially with the new zstd algorithm that should speedup the decompression).

from libzim.

veloman-yunkan avatar veloman-yunkan commented on September 16, 2024

How is this going to play with caching of (decompressed) clusters? If the chances are high that other blobs will be used from the same cluster while it is in the cache, decompressing the entire cluster once is better than partially decompressing it multiple times. A solution may be to cache the partially decompressed cluster together with the current state of the decompression. Then, if/when a blob from the not-yet-decompressed portion of the cluster is later needed, decompression can be performed incrementally from the point at which it was previously suspended.

from libzim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.