I've been testing out different methods to improve the time it takes to compile my entire c++ project. Currently it takes ~5 minutes. I experimented with distcc, ccache, and others. Recently, I discovered that if I copy my entire project onto a RAM-drive, and then compile from there, it cuts the compile time down to 30% of its original-- just 1.5 minutes.
Obviously, working from the RAM drive isn't practical. So, does anyone know of a way I can force the OS to always keep a certain directory cached? I still want the directory to get synced back to disk like normal, but I always want a copy of the data in memory as well. Is this possible?
As a possible solution, we just thought of launching a daemon that runs
rsync every 10 seconds or so to sync the disk drive with a RAM drive. Then we run the compilation from the RAM drive. The
rsync is blazing fast, but would this really work? Surely the OS could do better....