Blog

A really simple trick to speed up WWW browsing

A really simple trick to speed up WWW browsing

Linux

I notice that my system has /dev/shm mounted as tmpfs. Turns out you can write up to 4G (maybe more) of files to it like it were any other partition, and it’s basically a ramdisk that can also be partially written to swap. It doesn’t use 4G of RAM, it grows dynamically as you add stuff to it.

For grins, I did the following:

  1. in firefox, enter about:config in the address bar
  2. Find: browser.cache.disk.parent_directory
  3. If it exists, change it to /dev/shm, if not right click and add string browser.cache.disk.parent_directory, value /dev/shm
  4. close your browser and restart it

I noticed right away browsing was way faster. I’m getting < 1 second loads of various sites. Your mileage may vary!

I verified the cache is indeed being managed in /dev/shm as well:

$ du -sh /dev/shm/Cache/ 1.6M /dev/shm/Cache/

The downside?

You lose your cache when you reboot or shutdown then restart.

What’s nice about /dev/shm is you don’t have to muck with your startup/boot scripts to add a ramdisk, it’s already there.

I also did a meaningless benchmark. I copied a 350M file from hard drive to /dev/shm. First time it took 8 seconds, the second time (and 3rd thru nth) it took .5 seconds.  The 8 seconds was how long it took to read the 350M file into Linux’ filesystem cache; the 2nd time it copied from RAM to RAM.

Windows

The Windows XP solution, and it’s really fast too!

http://www.romexsoftware.com/download/

Download the free ramdisk software from the above link and install it.

Run the program and set up a ramdisk. I set up R: and used the default 64M (or 69M, whatever).

Use the same instructions as in post #1, but use R:\ as the value for browser.cache.disk.parent_directory.

Remarks

I didn’t do any particular before/after benchmarks, but the speed improvement is quite noticeable.  Hitting http://apple.com takes about 3 seconds (Linux) after clearing my cache.  The 2nd thru nth time takes 1 second or less.  Hitting apple.com (Windows) takes about 2.5 seconds with a cleared cache, .9 seconds otherwise.

The difference in speed between Windows and Linux is dependent on the browser add-ons I have installed (Linux is generally faster than Windows).

Related Articles

Technical

Accessibility on the Modern Web

There’s been a lot of buzz in the news lately about accessibility, specifically in reference to the dozens of ADA lawsuits that seem to be more and more...

Technical

Automated Visual Regression Testing

What is automated visual regression testing? The name sounds scary, but in reality, the idea is fairly simple. If you have a user interface (UI),...

Technical

Automated Testing Tool Comparisons

Automated testing is rapidly gaining popularity across the web development field, and as expected, the number of automated testing tools is growing rapidly as well....