Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

cacache is far too slow as a read and write cache to disk solution for hard-source.

On one test project on an older 13" MBP:

@latest #cacache
initial build 28s 38s
iterative build 4.7s 11s

Instead of replacing, cacache will be an optional serializer like leveldb. Replacing append-serializer will fall to a new version of its idea. Instead of so finely trying to maximize use of append mode files, write out a log file once, with the meta info at the beginning and in a separate file additionally. Reading all the files in reverse builds up the prior state.


  • readdir
  • filter log\d+
  • reverse
  • for each
    • read log
    • select header items not yet read
    • read items
    • deleted items are in the header with 0 length


  • while items
    • concat items below "max" size
      • write log with header of items
    • if item is "max" size write as its own log entry
    • remove items from set to be written


  • read but filter log\d+-meta
  • total is length of all items ignoring if its already read


  • when can i compact? determined by larger plugin?
  • read
  • delete
  • write
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment