Saturday, February 21, 2009

RAM Disks do not speed up Visual Studio

 

The limiting factor for Visual Studio is disk IO. I got a tip to speed up Visual Studio from Channel 9 by creating a RAM disk which sounded like a great idea. However, when I ran a thorough set of tests, I found that the performance difference between the Ram disk and the hard disk were not appreciably different. This was a big surprise since RAM is 240,000 times faster than disk (see my previous blog post). But the reason is because Visual Studio and Vista do a lot of caching. So compile times for the same project in RAM disk and on hard disk were pretty similar. I also tested the time it took to search the entire solution for a word, and times to open a solution. There was no discernable difference!

 

If you still want to try it out and create your own RAM disk, you can download a simple RAMDISK.EXE utility to create a RAM disk in just a few minutes. What is a RAM Disk ?  Ramdisk is a virtual drive created in RAM.

 

Performance Analysis

Creating files was an average of 1.5 times faster on the RAM disk. reading files was pretty much the same between the two disks. Copying a file was actually slightly slower on the RAM disk. All three visual studio tests were pretty much the same between the two.

 

What is the downside of a RAM disk?

Running drivers always give the chance of a blue-screen, and I did have one blue screen when I was first setting up the RAMDISK. (My guess is that I chose a non-default RAMDISK size at first. I typed in 200 instead of selecting 256 MB.) So save your stuff before you run the setup.

If your battery falls out or runs out of juice you will loose everything on your RAMDISK, but this rarely happens to my laptop. I always sleep my laptop instead of shutdown, so my data was always there when I woke my laptop up.

 

 

Performance Tests

So how much faster is a RAM disk than a standard 5,400 laptop hard disk? I used a simple utility DiskBench to measure disk performance.  The RAM Disk was 1.5 times faster creating files. But very surprisingly, for all other tests, the RAM disk and the hard disk were pretty much the same.

 

Conclusion

Sorry, a RAM disk isn’t going to help you out much. It doesn’t beat the natural caching of Visual Studio and Vista. Stick to the hard disk. Also, the pain of having to constantly copy a VS solution from the hard disk to the RAM disk means that it is definitely more pain than it is worth. Perhaps moving your temporary IE files folder would be a good application since it creates a lot of files.

 

Raw performance data.

Note R is the Ramdisk and C is the hard disk. During my test I tried various file sizes ranging from 50 MB to 180 MB. I performed file creation, file reading, and file writing tests. I ran one test against my C drive and then one test against my R drive (ram disk). I shut down all other programs that could potentially compete for IO.

Create File R: C:    
create file 60 MB 272 425   (milliseconds)
create file 60 MB 273 412    
create file 60 MB 206 419    
average: 250.3 418.7 1.7 times faster
create file 180 MB 978 1345    
create file 180 MB 870 1283    
create file 180 MB 945 1344    
average: 931.0 1324.0 1.4 times faster
  R: C:    
create file 192 MB 1034 1484    
create file 192 MB 1002 1427    
create file 192 MB 904 1334    
average: 980.0 1415.0 1.4 times faster
create overall average:     1.5 times faster
         
Read File R: C:    
read file 201 MB 255 272   (milliseconds)
read file 201 MB 269 249    
read file 201 MB 268 419    
read overall average: 264.0 313.3 1.2 times faster
         
Copy File R: C:    
copy 50 MB to same dir 144 143   (milliseconds)
copy 50 MB to same dir 150 119    
copy 50 MB to same dir 169 135    
copy 50 MB to same dir 118 121    
copy 50 MB to same dir 129 125    
copy 50 MB to same dir 117 121    
copy 50 MB to same dir 138 121    
copy overall average: 138 126.4 0.92 times faster (slower)
         
Visual Studio Test R: C:    
open solution with 100 files 5 3   (seconds)
  5 6    
average: 5 4.5   (pretty much the same)
         
Find word in VS R: C:    
  4 4   (seconds)
  5 5    
average: 4.5 4.5   (pretty much the same)
         
Run VS project R: C:    
  5 6    
  7 5    
average: 6 5.5   (pretty much the same)

7 comments:

Harry McIntyre said...

This is of course for Vista. Those of us on XP/2003 might still benefit from a RAM disk or eboostr (http://dotnet.agilekiwi.com/blog/2008/10/how-eboostr-works.html)

David Cuccia said...

Do SSDs speed up Visual Studio in Vista?

Dma550 said...

IMO, the place the ram disk really can help is in asp.net compilation. Simply setting your compilation tag like this:
compilation defaultLanguage="vb" debug="true" tempDirectory="r:\"
where r:\is your ramdisk really makes a noticable improvement. As pages compile on demand, their compilation and generation of all the .net temporary cached items occurs on the ram disk.

With an SSD you want to avoid small writes to the drive for performance and longevity. Watch a debug session compilation in procmon and you will be astounded at the number of writes that hit your disk during compilation on demand.

Andrew said...

I didn't see any information about what the specs on your laptop. But I know for my computer, there is NO comparison using pair of raptors in raid VS DDR800 that is running at 1ghz.

SSD's would help because their throughput is significantly faster for random IO's than a HDD.

Also, although this is highly ram dependent, you should turn off file paging so your ram is NOT being cached. Having wonderful Vista cache your ramdisk is pretty redundant. No wonder you had incredible horrible results.

nesteruk said...

Your experimental method was completely wrong; that's why you didn't get the benefit. What you should have done is install Windows and Visual studio in RAM. Just having the solution in RAM gives only a small performance benefit and is, in most cases, not worth it.

This article is thus a bit misleading.

Joseph Fluckiger said...

Installing Visual Studio in RAM is completely impractical.

Yorkshire Hills Board said...

I can confirm that a RAM disk does not speed up builds. A real surprise but it appears to be true.