# X swap file - potential speed up



## MacDoc (Nov 3, 2001)

*X swap file - BIG!!!!!! speed up and KISS to do*

*The simplest speed up for X I've seen.* 
I've re-written this after Pam's tip lead me to a terrific combo. :clap:

*Download Swap Cop and Tiger Cache Cleaner *

Run TCC and use the RAM disc option and allocate 1/4 - 1/3 of your physical RAM

Point the swap files to it the RAM disc by way of Swap Cop and a get a very nice speed bump.

I'm using a 1 gig RAM disc with 4 gigs of real memory total.
It's very noticeable. Yippee - one bottleneck gone.

and RAM is cheap these days  
8 gigs with a 4 gig RAM disc here I come.

BTW Photoshop would get a nice bump with this as well. Point the scratch disc to the RAM disc. 

This will also help when you have a second drive or a fast sector partition on your main drive

It's bugged me that we cannot dedicate a clean fast area of drives to a dedicated swap space.....or even better a second drive.
Mmmmmm 250 boot drive partitioned with a Raptor 10k swap drive also partitioned to keep the swap files in the fastest portion...... Yum :clap:

But the RAM disc gives you the best performance.


----------



## Pamela (Feb 20, 2003)

I take it you aren't talking about using a partitioned part of the drive and then using Swap Cop ?


----------



## Guest (Jun 30, 2005)

This may or may not help out your setup speed wise. It really depends on what you're doing, how much ram you have in your machine, etc etc. The best bet for speed is to try not to swap at all, but if you have to then a separate fast drive will help (especially with the non fragmented 80MB chunks). Sadly with OSX it's nearly impossible not to swap (check the activity monitor and the VM usage for each app and you'll see why). Most other *nix setups are able to run without swap given a good amount of ram and good usage practices, but i wouldn't try this with OSX!!


----------



## MacDoc (Nov 3, 2001)

Hey cool app Pamela - I assume it works across multiple drives. :clap:

LOVE that open source community.

I would really like someone with a Mini or Powerbook to try this. I don't have a reference so before and after comments would be appreciated.

Doing this with a Mini with a Firewire drive attached would be a no-brainer.

Just remember to make a partition on the fastest part of the drive and that would be the first partition. Keep it empty and let the cats play unimpeded by clutter.


----------



## Pamela (Feb 20, 2003)

I've been doing it with my powerbooks since day one. 2 years on four different computers with Panther. Sure hasn't done any damage that's for sure.


----------



## Guest (Jun 30, 2005)

I might give this a shot with my Mini and firewire drive over the weekend and see if it helps any, I'll report back the results here


----------



## MacDoc (Nov 3, 2001)

Oh my what an interesting thing just turned up .
I used Tiger Cache Cleaner to create a 1 gig RAM disc and pointed SwapShop to it. 
First indications with surfing etc are very very good.

That should effectively eliminate the swapping to the drive. :clap:

Oh wow what a fantastic combo.

You do have to set up the RAM disc each time on a restart ( 10 seconds ) but Swap Cop remembers it.
The difference is very very noticeable even on a G5.
The 4 gigs of RAM of course helps a bunch but this is a terrific speed trick and should keep things going quicker over time.


----------



## MacDoc (Nov 3, 2001)

This works BIG TIME - try it!!!!! I'm gonna keep bumpin' it til it gets the attention it deserves.

*The simplest speed up for X I've seen.* 

*Download Swap Cop and Tiger Cache Cleaner *

Run TCC and use the RAM disc option and allocate 1/4 - 1/3 of your physical RAM

Point the swap files to it the RAM disc by way of Swap Cop and a get a very nice speed bump.

I'm using a 1 gig RAM disc with 4 gigs of real memory total.
It's very noticeable. Yippee - one bottleneck gone.

and RAM is cheap these days  
8 gigs with a 4 gig RAM disc here I come.

BTW Photoshop would get a nice bump with this as well. Point the scratch disc to the RAM disc. 

This will also help when you have a second drive or a fast sector partition on your main drive

It's bugged me that we cannot dedicate a clean fast area of drives to a dedicated swap space.....or even better a second drive.
Mmmmmm 250 boot drive partitioned with a Raptor 10k swap drive also partitioned to keep the swap files in the fastest portion...... Yum :clap:

But the RAM disc gives you the best performance.


----------



## MACSPECTRUM (Oct 31, 2002)

i have a pb 15" 1.33 ghz, w/ 1 gb ram and have allocated 256 mb to a ram disk and used swap cop to point my swap files to it

noticeable difference

i might just be calling macdoc for some more ram so i can allocate more ram disk


----------



## thejst (Feb 1, 2005)

what about when Swap Cop asks to restart to have changes take effect? When I reboot, the Ram disk is gone! 

is rebooting even neccesary? my g5 seems a lot faster now...


----------



## MacDoc (Nov 3, 2001)

I think the reboot is just to clear the previous swap files and no I don't think it's needed.

It only takes a minute to re-establish the RAM disc and Swap Cop remembers it anyway.

I'm still looking for another utility with a permanent RAM disc feature ( reallocates automatically ).

It's been a real pleasure for the last couple of days working with this set up. It brings a snappiiness back that I had missed from OS9 days.
Remarkable combination of two utilities.

I'm trying to get some traction on this as it really is 

a) easy
b) very worthwhile

Spread the word.


----------



## thejst (Feb 1, 2005)

it is pretty speeedy!


----------



## MacDoc (Nov 3, 2001)

Well there is something weird - I don't think the swap file is moved at all after some testing on an external drive BUT the minute that RAM disc fires up something speeds up.

Still trying to puzzle this out.
Some weird buffering maybe.????


----------



## iPetie (Nov 25, 2003)

MacDoc, do you think this would work on my ALBook 867 with 640 Ram? If so, what settings would you recommend? Do you think I would need a Gig?


----------



## lunchbox (Aug 25, 2004)

I second this query on the 867 Al book

thanks!


----------



## MacDoc (Nov 3, 2001)

Forget the swap file for the moment and just put a 256k RAM disc and see what the effect is.
We're trying to figure out why the presence of the RAM disc bumps up the "snap" factor.


----------



## TroutMaskReplica (Feb 28, 2003)

macdoc, would you recommend a ram disc on the following setup?

dual 1.25
2 gb ram
2 40 gb drives in a raid and 1 120 gb backup.

if i make a ram disc that is 1 gb, that takes away 1 gb from the system, no? i guess my question is, how much ram does one need for this to become practical?


----------



## MacDoc (Nov 3, 2001)

It seems very little - we're not sure the mechanism of why the RAM disc speeds response. gonna be flying by feel here..


----------



## MACSPECTRUM (Oct 31, 2002)

good article on OS X and RAM disks

http://www.clarkwoodsoftware.com/rambunctious/RDOSX.html

interesting side benefit for laptop users
_
RAM disks require less power. For laptop users in particular, using RAM disks in your workflow patterns can dramatically increase battery life.

For users of both laptop and desktop systems who set up hard drive spin-down times, judicious use of a RAM disk will allow the hard drive to spin down sooner and spin up less frequently. This means less hard drive abuse and less noise.
_


----------



## MACSPECTRUM (Oct 31, 2002)

TroutMaskReplica said:


> macdoc, would you recommend a ram disc on the following setup?
> 
> dual 1.25
> 2 gb ram
> ...



start with 512 mb and work up and down from there gauging performance
TTC allows you to change the size of the RAM disk


----------



## MACSPECTRUM (Oct 31, 2002)

from tiger cache cleaner website

_
Tiger Cache Cleaner can improve system performance by tuning internet and file caching settings and by implementing ram disks.
_


----------



## Vexel (Jan 30, 2005)

Apprentice of MACSPECTRUM here 

I've been doing it for a day now.. it's quite the difference. I actually only have 512 Megs of RAM in my iBook.. and I gave the RAM disk 128 Mb's. The difference is definitely noticable.


----------



## MACSPECTRUM (Oct 31, 2002)

one more side benefit it increased battery life for us "book" users due to less hard drive access due to swap files going to ram disk

zoom zoom


----------



## ernestworthing (Jun 10, 2004)

Some free RAM Disk software here:
http://macupdate.com/search.php?keywords=ram+disk&os=macosx&button.x=0&button.y=0

(tcc isn't free)


----------



## Vexel (Jan 30, 2005)

Esperance DV

http://macupdate.com/info.php/id/16518

This one's the ticket folks.. its a Preference Pane... AND.. it allows you to Auto-Mount your RAM DISK! w00t! 

I just installed.. works perfect under Tiger.. and it looks great too 

Oh.. and it's FREE!


----------



## ernestworthing (Jun 10, 2004)

Take a look at this:
http://www.sciencequest.org/support...pics/application_specific/osx/swapswapvm.html

I took a look at my RAM disk and indeed, it seems that the swap files haven't been moved at all. I checked my /etc/rc and diff'ed it with rc.backup.swapcop.... no difference.


----------



## Vexel (Jan 30, 2005)

isn't the rc.backup.swapcop file the one for backing up? Not the one that's in use? Meaning.. it's your original settings?


----------



## ernestworthing (Jun 10, 2004)

That's correct. If rc.backup.swapcop is the same as rc, that means no changes have been made.

And the dynamic pager is still pointing to the original swap location.

$ ps -ax |grep swap
26 ?? Ss 0:00.00 /sbin/dynamic_pager -F /private/var/vm/swapfile

Somehow SwapCop doesn't want to do anything on my 10.4.2 system. I may have to modify the /etc/rc file directly.


----------



## Vexel (Jan 30, 2005)

It just means that it's not doing anything to your old settings. It is working.. The rc.backup.swapcop file is just the backup to your original default settings. Swapcop tells you this when you create the swap.

I have no idea where to look.. to see the settings for the new mapped swap. But.. it does work. There's definitely a noticable difference here.


----------



## thejst (Feb 1, 2005)

question for Vexel:

so I dl'd the esperance dv program, ran the installer and set up a 128 MB ram disk on my desktop...is there anything else I need to do? How do I know that the swapfile is being directed there?

James


----------



## Vexel (Jan 30, 2005)

thejst said:


> question for Vexel:
> 
> so I dl'd the esperance dv program, ran the installer and set up a 128 MB ram disk on my desktop...is there anything else I need to do? How do I know that the swapfile is being directed there?
> 
> James


 Download SwapCop.. and direct your Swaps to the new RAM Disk.


----------



## ernestworthing (Jun 10, 2004)

Vexel said:


> It just means that it's not doing anything to your old settings. It is working.. The rc.backup.swapcop file is just the backup to your original default settings. Swapcop tells you this when you create the swap.


Not quite. In my /etc/rc, the swapfile line reads:

swapdir=/private/var/vm

Which means it has not been redirected to, in my case, /Volumes/.Ramdisk.
Among other things, Swapcop is supposed to change that line and do an automount. So Swapcop isn't working on my machine.

Incidentally, checking the dynamic pager is the recommended way of checking the current swapfile location.


----------



## Vexel (Jan 30, 2005)

Hmm.. I see what you mean now.

Let me know if you have any results. I still don't understand the performance gain? That's really weird. It definitely is noticable.. unless I'm a complete tool..


----------



## thejst (Feb 1, 2005)

Seriously, I'm with Vexel- Whether the swapfile is moved or not, this computer seems a lot faster to me....Web Pages snap open, Images render faster- Apps open really fast as well!
James


----------



## MacDoc (Nov 3, 2001)

Yes I think it has nothing to do with the swap file application but something with the RAM disc interacting with the OS memory management. Really has me scratching my head.


----------



## The Great Waka (Nov 26, 2002)

I too tried this with Esperance DV and SwapCop, and I found that SwapCop didn't change my swap file location. After running it and restarting and everything, I did a search for the swapfile files (swapfile1, swapfile2, etc) and they were still located in the original /vm/whatever it is. So SwapCop didn't clear them. So I manually moved one of them to the ram disk and deleted the rest, and there was a slight improvement, but new swap files were never created on the ram disk, and everytime I woke from sleep or restarted (restarting isn't often, but waking is), it seems to default back to the original directory and ignore the ram disk. 

I figured that there was a problem with SwapCop, as when I restarted like it asked me to and then run it again to clear the old swapfiles, it says that the clearing is complete, but then the progress bar keeps going and never disappears until I quit. Bug with the problem maybe?

Could the problem also be that the ram disk mounts too late and the system defaults back to its original swap location?

I would love to be able to use this, as I did notice a slight difference. I have 768MB of RAM in my powerbook, and I alloted 160MB to the ram disk (enough for two swapfiles).


----------



## Vexel (Jan 30, 2005)

I simply just can't figure it out. It really does speed up the machine.. whether or not it changes the swap partiton or not. 

I have my RamDisk starting on Start-Up of the machine... and voila.. it works great. Not sure what to make of it.


----------



## Vexel (Jan 30, 2005)

MacDoc, anything on this yet? It still boggles me. However, I've been using it steady for almost a month. It's still quite fast. Anyone else tried it?


----------



## TroutMaskReplica (Feb 28, 2003)

> I found that SwapCop didn't change my swap file location. After running it and restarting and everything, I did a search for the swapfile files (swapfile1, swapfile2, etc) and they were still located in the original /vm/whatever it is. So SwapCop didn't clear them


me too. i wasn't able to get this working. c'est la vie.


----------



## Macaholic (Jan 7, 2003)

Well, after working on this for a couple of hours I'm pretty frustrated.  

As we all know, SwapCop allows you to specify the volume name for the new swap destination. Well, I create a RAM Disk in Esperance DV, leaving it as the default name of "RamDisk". I then assign "RamDisk" as the swap volume and go through the reboot process as SwapCop directs.

WELL, when my ****ing Mac reboots, * the RAM disk that gets created by Esperance DV is called "RamDisk 1"!* Therefore, the system cannot find its assigned volume ("RamDisk" -- NO NUMBER) to write the swap files to! WTF?!









Another odd thing is that SwapCop offers up an old name for a disk of mine; a disk that is now part of my striped RAID and no longer "there", so to speak. Yes, I run all the CHRON tasks and delete all the logs (many times since I went with a RAID). 

Throughout all my attempts (leaving RamDisk 1 active and trying to add another named just Ram Disk -- which results in a "Ram Disk 2" upon reboot), I DID once see the temp folder in the dissk... but then I had more than one RAM disk mounted  

So, I dunno here


----------



## jfpoole (Sep 26, 2002)

Putting the swap file on a RAM disk seems silly to me. The whole point of a swap file is to let the computer function as if it has more RAM than it really does (i.e., virtual memory).

By creating a RAM disk you're reducing the amount of memory available, making it more likely you'll need to access the swap file. Since the swap file can't grow any larger than the RAM disk, the total amount of virtual memory you'll be able to access will never exceed the amount of physical memory you have. 

Why not just save yourself the trouble of setting up a swap file on a RAM disk in the first place, especially if you're not accessing the swap file[1] at all? 

[1] You can figure out if you're accessing the swap file with the Activity Monitor. Under the System Memory tab there's a field that counts page ins and outs. If the number of page outs is zero, then you're not accessing the swap file.


----------



## cdiggy (Jan 2, 2006)

I agree with JFPOOLE. If you have Menu Meters, check the memory usage. Under VM Statistics, if it says '0 Pageouts' then you aren't even touching the swap file. Another indicator is 'Total Swap Space'. If your swap space stays at 64MB then that's another indicator that you aren't touching the swap file. 

I just installed 2Gigs of ram into my iMacG5 so I've been watching this to see just how significant the extra ram is. I noticed a huge performance boost just from the ram itself. I believe you are chasing a rainbow thinking that moving your swap file to a ram disk will give you even better performance. If you are hungry for a performance boost, get more ram. 

End Of Story


----------

