Running your build/source code from a ram disk.


As a test I wanted to run a build from a drive in ram rather than on a physical disk drive using the old Dos style Ram disk. For a trivial build that includes compilation, compilation, database updates, unit test, and integration tests. I saw the build time decrease by 41%. That is pretty good.


Running MvcContrib build using this same method return the following results, a decrease in build time from 37 to 28.7 seconds.


I am running this from an XP virtual machine with the ram disk that is available for free from here:

This is just a prototype and I am just playing with this idea right now.  Next I am going to do some tests with loading database files to the ram disk and look at some options for ensuing all my data is not lost…. The important thing to know about the RAM Disk is that when the machine shuts down it dumps the contents of the disk.  There are some options where the drive can be mapped to an image file so that the drive can start up with some basic configuration.  More to come….

About Eric Hexter

I am the CTO for QuarterSpot. I (co)Founded MvcContrib, Should, Solution Factory, and Pstrami open source projects. I have co-authored MVC 2 in Action, MVC3 in Action, and MVC 4 in Action. I co-founded online events like mvcConf, aspConf, and Community for MVC. I am also a Microsoft MVP in ASP.Net.
This entry was posted in .Net, c#, testing. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • Jeremy Gray

    The workstation provided by my current client is hamstrung by the corporate virus scanner and its configuration, so I have upgraded the RAM and am doing daily development with the entire codebase loaded into a rather large RAM disk, though one that automatically flushes back to disk at a configurable interval of time. The difference in overall development experience is staggering.

    Your post is a timely one because I am very soon going to do the same thing to our build server, which is similarly impacted by virus-scanner-related disk access overhead, and while the RAM disk doesn’t negate the on-demand scanning, it at least makes it somewhat less painful.

  • YMMV so give it a try, but in general Windows disk caching is very good and ram disks don’t normally yield that much of an increase. In fact, allocating too much memory to a ramdisk can actually slow a machine down by robbig the OS of resources that would otherwise be given up to caching.

    This is coming from a guy that always had a RAM: on his Amiga. :-) Also years ago on NT 4.0 I was doing PowerBuilder builds and I used a program from Cenatek called RamDiskNT that dropped my full bootstrap import and regen time from 1:45 to :25 (minutes). Moving to Windows 2000 and I was able to get the same performance without a ram drive.

  • Eric, are you using a RAM drive *because* you are compiling in a virtual machine, and maybe disk access is slower, or are you using a virtual machine as a temporary/experimental place to try new ideas? Interesting stats. Thanks.