RAM drive for compiling - is there such a thing?

后端 未结 18 2051
既然无缘
既然无缘 2020-12-02 08:16

An answer (see below) to one of the questions right here on Stack Overflow gave me an idea for a great little piece of software that could be in

18条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-02 08:30

    Some ideas off the top of my head:

    Use Sysinternals' Process Monitor (not Process Explorer) to check what goes on during a build - this will let you see if %temp% is used, for instance (keep in mind that response files are probably created with FILE_ATTRIBUTE_TEMPORARY which should prevent disk writes if possible, though). I've moved my %TEMP% to a RAM disk, and that gives me minor speedups in general.

    Get a RAM disk that supports automatically loading/saving disk images, so you don't have to use boot scripts to do this. Sequential read/write of a single disk image is faster than syncing a lot of small files.

    Place your often-used/large header files on the RAM disk, and override your compiler standard paths to use the RAM drive copies. It will likely not give that much of an improvement after first-time builds, though, as the OS caches the standard headers.

    Keep your source files on your harddrive, and sync to the RAM disk - not the other way around. Check out MirrorFolder for doing realtime synchronization between folders - it achieves this via a filter driver, so only synchronizes what is necessary (and only does changes - a 4 KB write to a 2 GB file will only cause a 4 KB write to the target folder). Figure out how to make your IDE build from the RAM drive although the source files are on your harddisk... and keep in mind that you'll need a large RAM drive for large projects.

提交回复
热议问题