So, this all began when I received a brand new Dell Latitude E6540 laptop for work, armed with 16Gb of RAM and a 500Gb spinning rust HDD.
Oh, and all the drive contents are encrypted via McAfee, thanks to corporate security policies.
After some use, (and one HDD failure), I noticed that the HDD was constantly getting trashed, especially when it came to managing temporary files used by applications like Visual Studio 2012/3 and ReSharper.
I also noticed that out of the 16Gb of RAM installed on the laptop, the maximum usage never went over 6/8Gb, leaving a lot of free RAM just hanging around, doing nothing.
Then an idea hit me with the force of a 90’s acid flashback.
Remember back in the old DOS days, when you could configure RAM drives (virtual hard drives which allocated their space in RAM)?
Well, it turns out you can still do that today in Windows!
I found a great utility called ImDisk Toolkit which enables you to create RAM drives with ease.
Once installed, run the RamDisk Configuration shortcut and you should be presented with the following screens (Basic and Advanced):
I chose to allocate 1Gb of RAM for the drive size, left the drive letter assignment as R:, as well as left the file system type to NTFS.
Enable the options for Launch at Windows Startup, and Create TEMP Folder.
Click on the Set TEMP Variables… button and you’ll be presented with the following screens:
Click the Set All To: button to point all your temporary file paths to the newly created RAM drive (in this case, R:\Temp)
Click OK to save the settings, and then lets move onto the Advanced tab.
On this screen, make sure you’ve checked the Use AWE physical memory, as this guarantees that the memory is never written to the Windows page-file (which would kind of make this entire exercise pointless).
Click OK, and viola! You have a brand new 1Gb RAM drive which will handle all your temporary file management. A restart will be required for all the settings to take hold.
Once restarted, we need to configure ReSharper to point to the new RAM drive for its temporary file handling (this normally happens when you’ve enabled Solution Wide Analysis, etc.)
Open up Visual Studio, choose the ReSharper menu item and then select Options…
Choose the System TEMP folder option and Save your settings, thereafter, restart Visual Studio and ReSharper should start dumping all of its temporary files into the RAM drive location.
Now, enable solution wide analysis on any of your existing .NET projects and see if you can notice a marked improvement in analysis speed. Your mileage may vary, especially if your existing conditions are not like mine (non-SSD, encrypted drive by McAfee, etc.)
Here are some benchmarks on how the standard HDD performs:
These are the results using an SSD drive:
And here are some benchmarks on how the RAM drive performs:
I’d love to hear your feedback on whether this has helped improve the speeds of your development workflow in any way.