Memory/Real filesystem hybrid
It would be nice to have something like MemoryFileSystem that can be initialized from an actual directory on disk. Write operations would always write to memory. Read operations would check for an in-memory version of the file first, and if it didn't find it check for an on-disk version.
Today, there are tests in flutter_tool that have to initialize an in memory FS, copy a bunch of stuff from disk, and then go on their way. The proposal here is to let us lazily do that copy so we only end up with more memory usage (and data copying) if we attempt to modify a file (rather than just read it).
/cc @jonahwilliams
In other words, a copy on write memory file system that's just backed by the disk for reads.
Interestingly, the testing scenario is backwards from a production scenario where you'd want the file cached in memory for fast reads and where you want writes to be persisted to the disk...
I have no idea if it'd be feasible, but I think this could be more generally useful as a CoW filesystem class that would take a pair of FileSystem arguments, and then the write destination also could be a ChrootFileSystem in /tmp or somewhere.
I've taken a stab at this a couple times, but it becomes really hard to track down. I agree the CoW seems really good, but it gets really hard to keep track of once you start dealing with directories and symlinks and such. It should be possible but it's not trivial.