turbo
f6b980ae - Reduce memory usage when writing files (#3526)

Commit
2 years ago
Reduce memory usage when writing files (#3526) This PR reduces the our total memory usage (hopefully) for files that we write to disk. When we write a file, we obviously have the input bytes (the bytes we want to write to disk). But we also read the file to see if the file needs to be written at all. This means we have _another_ copy of the bytes, the ones that came from the disk. Worse, our write is strongly dependent on the read's `RopeVc`. Meaning we're stuck with that read memory until some indeterminate time. And any time we update the written contents, we're gonna get more bytes stuck in our Vc cache. The goal here is to track the file, so that we can rewrite it if it's modified/deleted. Why not have an API specific to tracking, without actually reading any contents? This PR does exactly that. And now that we don't need to read contents to track, we can avoid using the `read()` API (and its `RopeVc`) in order to do our new-old contents comparison.
Author
Parents
Loading