6 ms·
Tmpfs is great. If you're a compiled language person and the build dir isn't in a tmpfs yet, give it a try. Faster than nvme and less prone to burning out from
by JonChesterfield 2y ago
Tmpfs is great. If you're a compiled language person and the build dir isn't in a tmpfs yet, give it a try. Faster than nvme and less prone to burning out from lots of writes.
Defaulting to /tmp in tmpfs means I can remove a line from my post install setup script. That doesn't matter much. But it also means less divergence between my system and the default, so there should be a reliability improvement from other people stumbling over problems with the ramdisk before me. So a win all around, happy to see it.
- tombert 2y agoWhat's especially fun is using tmpfs as root on NixOS. That way your root partition gets cleared out on any reboot, so cleaning up your mess is never really more than a reboot away. I've never thought about mounting a tmpfs folder for compiling stuff, but that's actually a pretty good idea.
- Aurornis 2y ago> I've never thought about mounting a tmpfs folder for compiling stuff, but that's actually a pretty good idea. Using tmpfs (or RAMDISK) for compiling and discovering that it’s not actually faster is a virtually rite of passage for every developer. :) If you do try it, at least benchmark it. You’ll probably discover that you spent more time setting it up and copying files around to volatile storage than you’d ever gain back via minuscule compile time speedups. Compiling is not IO bound and your files are already being cached in RAM by the OS after the first read.
- tombert 2y agoIt’s actually not really about speed in my particular case; I mostly just don’t want lots of tiny intermediate files being written and rewritten on my SSD all the time. I would sleep better if I knew that they wouldn’t have any negative effects on the lifetime of my drive. I have a tmpfs folder mounted for my downloads folder for my browser for similar reasons; not for speed but to reduce drive wear and automatic cleanup so that it doesn’t pile up for forever.
- JonChesterfield 2y agoIt's faster. I don't move the source code around though, the intermediate build directory cmake writes binaries into is under a tmpfs mount and the install dir is back on disk. Currently has 10gb in it with 30m of uptime. The gain would be less if I was more willing to trust ccache, or if the cmake dependency graph of the project was trustworthy - my default build deletes all the files from the last one.
- toast0 2y ago> If you do try it, at least benchmark it. You’ll probably discover that you spent more time setting it up and copying files around to volatile storage than you’d ever gain back via minuscule compile time speedups. Compiling is not IO bound and your files are already being cached in RAM by the OS after the first read. You shouldn't need to copy files to volatile storage, just storing the outputs there. Maybe only storing the intermediate outputs there. Some build processes just dump intermediate outputs all over the place, but a lot of them have a directory for those, and it shouldn't take much to make that directory be on tmpfs or similar.
- MrDrMcCoy 2y agoI don't do it for speed. I do it because I'm abusive enough to my storage even without that.
- Aurornis 2y ago> If you're a compiled language person and the build dir isn't in a tmpfs yet, give it a try. Faster than nvme What are you compiling that’s actually faster in tmpfs? A decade ago, people were surprised to discover that going from HDDs to SSDs didn’t impact compile times very much. The files are quickly cached in RAM anyway and the bulk of build time is CPU, not I/O. Going from NVMe to tmpfs feels like an even smaller difference.
- saagarjha 2y agoKeep in mind that on macOS /tmp is some very cursed link to /private/var/tmp and some projects will get very confused by this.
- NekkoDroid 2y ago> But it also means less divergence between my system and the default This is one reason I like Arch. It is almost as vanilla as can be (some exceptions may apply) while still being a "build it yourself Lego set" (build not in the compile sense).
- tombert 2y agoYeah, it's kind of hard to go back once you've embraced the "build your own distro" distros. Arch, Gentoo, and NixOS Minimal are all pretty wonderful in that they give you the tools to build whatever system you want, without a bunch of extra crap that you'll never use.
- JonChesterfield 2y agoWouldn't that be the opposite? I like the base userspace to be very boring, where broken things have been stumbled over and fixed before I run into them. Everyone having their own bespoke set of pieces makes the divergence between what you're running and what other people are running greater.