Development

The case for better I/O in ReSharper

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):

ramdisk_configramdisk_config_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:

temp_variables_before

Click the Set All To: button to point all your temporary file paths to the newly created RAM drive (in this case, R:\Temp)

temp_variables_after

Click OK to save the settings, and then lets move onto the Advanced tab.

ramdisk_config_advanced

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…

resharper_settings

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:

hdd_speed
ST500LM000-1EJ162

These are the results using an SSD drive:

ssd_performance
OCZ-VERTEX4

And here are some benchmarks on how the RAM drive performs:

ramdisk_speed
RAM Disk

I’d love to hear your feedback on whether this has helped improve the speeds of your development workflow in any way.

G.

 

4 thoughts on “The case for better I/O in ReSharper”

  1. Hi. Nice article. Congrats! Which version of Resharper are you using? I wanted to try pointing the cache to a custom folder instead of TEMP folder (I saw the option in your print) but this option is not available for me (r# 8.2.3).

  2. I often switch between having ReSharper turned on and off. Sometimes the overhead it adds to Visual Studio is just to much. But then, I have near muscle memory for all the shortcut keys, which does not work in Visual Studio. The guidance in this blog vastly improved ReSharper performance on my work Latitude. Right after submitting this comment, I am applying it to my home machine too. It is simple that much of an improvement. Thanks.

Leave a Reply to Gareth Cancel reply

Your email address will not be published. Required fields are marked *