neonrust / epm

Command-line TV episode calendar/manager/scheduler/tracker (EPisode Manager)
MIT License
0 stars 0 forks source link

Also compress the active db file #43

Closed neonrust closed 7 months ago

neonrust commented 7 months ago

Currently, the active db file (series) is not compressed; only the backups are. Also compressing the active one has several benefits.

  1. Reading the compressed file is very fast. With zstd, it's negligible. (it it's on a "slow" medium, it's probably faster than uncompressed, but I doubt that's the case nowadays)
  2. When writing the series file we already need to compress 1 file (the .1 backup).
  3. With "sparse" backups (for #42), we don't need to compress anything.
  4. Rolling back a backup is essentially a no-op.

Ideally, we should figure out how to reading and decompressing at the same time, i.e. the equivalent of zstd -d -c file.zst | jless. Or, at the very least, test if that is faster. That being said, orjson doesn't support reading from a file descriptor, so maybe this would be pointless.

Preferrably, this should be done before #42.