As an FYI, your mileage may differ severely, but for builds here, I've setup a tmpfs RAM disk on Linux which is large enough to fit the entire build output (object files), but not the build input (C, C++ code). We generate around 6G of objects, static, and shared libraries across about 3100 output files. Putting it onto a tmpfs RAM disk sped up the build around 10% for our workload. As the host has 32G of RAM and sits idle using a small portion of that, allocating 8G for a tmpfs RAM drive doesn't hurt. Large link steps were causing some pretty horrific system response times when on spinning disk, but those have gone away with using RAM.
I don't put the input files into tmpfs as I don't want to lose changes in the event of a system failure.
Home: Corsair 760T, Seasonic 760 Platinum, Z170 Deluxe, 6700k @ 4.2 GHz, NH-D15, 16G DDR4 2400, 850 EVO 1T, 840 EVO 256G, GTX 1080, U3011, Linux, Windows 10
Work: Arc Midi, 650TX, P8Z77-V LK, 3770, 32G, 830 128G, 2x1TB, NVS 295, 2xU3014, Linux