Speed-up tip. :)

Discussion in 'Apple Desktop Hardware/Software' started by Bifurcator, Feb 8, 2013.

  1. Bifurcator

    Bifurcator Member

    Joined:
    Aug 13, 2012
    Messages:
    43
    Location:
    Japan
    Requirements:
    Mac computer running OS X, 16GB or RAM or more.

    Here's one I discovered. I was researching some ways to optimize my system for photo editing and web browsing (which is about all I do with my system these days - being retired and all) when I came across an article by Perry Metzger written on Apr 3, 2012. The article outlined how to turn off OS X Lion's dynamic paging MMU system. I thought whack at first but I have 32GB of ram and haven't ran out or even neared the top for months so I decided to give it a try. The commands to do this are:

    sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist

    followed by a reboot. And you can turn it on again with:

    sudo launchctl load -wF /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist ​


    Some people claim this is a also a good way of enhancing the lifespan of your SSD drives as well. I do notice SIGNIFICANTLY less rotational-drive chatter and many many operations are noticeably faster. Especially OS operations like browsing around in folders with hundreds or thousands of images in each. Icons once displayed are actually instant... I don't mean fast either. On my system they were fast before. This is instant. Poof! A maximized window populated with any sized icons of RAW (or any kind of) images just appears and scrolling to the bottom of multiple folders each containing 4,000+ images works the same way. Browsing images in LR was sped up by about 10 or 20% too. Good news for those who like LR. Bridge was already very fast (about 6 to 8 times faster than LR) for poking around in image folders but it too became slightly faster. It's too fast in the first place to measure proper differences but doing the best I could with my stop-watch it's about double the speed with 1st time page displays (from about 2s to about 1s) and instant every time after that - for hours and hours and hours... and hours...

    I don't recommend doing this with only 8GB or less however. But if you have 24GB or more then I feel comfortable recommending running your machine full-time with the dynamic pager turned off. 16GB would probably be OK too. It works on my older 12GB mac pro system just fine. This is why "with lots of RAM" is in the title. Furthermore you should probably run some kind of memory monitor in the BG. I've been using MenuMeters since, like, forever... so I didn't need to add anything to the installation.

    I guess this will help with all versions of OS X from about 10.5 on up - which is when the paging system in OS X became slightly ridiculous. Give it a try and let us know after a few days of use, what you think.

    Someone mentioned on another site that this is potentially dangerous in low memory conditions so I gave that a test and here are my results:


    I loaded PS and upsized a two layer image file to 2,800 megapixels. It was noticeably faster than usual. Maybe 3 or 4 times faster. Odd that - I dunno why. I guess it has something to do with the continuity of RAM with that dynamic pager turned off but that's only a guess.

    [​IMG]

    And loaded a bunch of heavy-ish apps:

    [​IMG]

    PS: 2 layer 2,800 megapixel image opened,
    Safari: about 20 tabs opened with several on image threads and one (displayed) with about 120 images in it,
    iTunes: 2739 albums displayed and all icons cached,
    Mail: with over 1 million messages in the displayed DB,
    6 Finder windows each displaying cached icons for over 400 images (plus sidecars) each - all cached,
    Adobe Bridge: displaying 1,068 images,
    iPhoto: Displaying the mouse-over icon anims for about 180 albums.
    LR 4 (newest update): In develop mode pointed to a library of about 600 images,
    And Dashboard switched to with all those little applets loaded (about 16). ​


    I then loaded "Hardware Monitor", set up a panel just monitoring Free Memory and started quitting applications. I waited a little bit to let things settle down although there were no signs that anything needed settling which is HIGHLY unusual for OS X (!!!) and looked at the VM profile that Menumeters shows:

    [​IMG]

    Then I came here to write this and of this moment there is a tad over 4GB of RAM being used (Safari is being used (reopened) with those same 20 tabs open - and iTunes is still going because I dig this song too much to quit it). When OS X first starts up with everything I have added on it occupies about 3GB of RAM. And now any one of the apps or windows I just had opened will open instantly. I tried PS it took 4 seconds to load. I tried the finder window showing 1,068 images and all the icons were already rendered - the window expanded into view with the icons in place and the entire set of 1,068 images were all still cached.

    And I should add that browsing and clicking around in the finder windows is suuuuper smooth right now. Normally had I done something like the above I would be making coffee waiting for the system to stabilize and hoping it didn't crash.

    You can try this tip with less than 16GB if you like. It won't hurt anything. Just don't get too involved in a work project until after you have tested out the system with this modification in place to make sure it will be stable for you.
     
  2. FreelancerJ

    FreelancerJ Member

    Joined:
    Mar 14, 2010
    Messages:
    127
    Looks nice, pity not all of us have 16GB+ Macs abouts.... *dreams

    It'd be cool if there was a go-between with this, like, rather than turning paging off completely, just reducing it's sensitivity... Like so it only swings into action when you're getting near full RAM usage. Give that speed up for lighter usage but isn't overzealous with it's paging when it doesn't need to be.
    Still, very cool, when I finally do have a Mac Pro saved for and brought home, that I'm sure will be plenty useful :)
     
  3. OP
    OP
    Bifurcator

    Bifurcator Member

    Joined:
    Aug 13, 2012
    Messages:
    43
    Location:
    Japan
    Yes, wouldn't it be nice if there was a way to defer these particular paging operations to a definable schedule? :D I dunno, maybe we can... I don't know how though. All I found was this on/off switch and since it needs a reboot to take affect there's no way that I know of to script a schedule and have the result be meaningful.

    On RAM amounts memory is pretty cheap right now. Typically a 16GB upgrade is between $100 and $200 depending on the age and type of your mac.




    .
     
    Last edited: Feb 11, 2013
  4. OP
    OP
    Bifurcator

    Bifurcator Member

    Joined:
    Aug 13, 2012
    Messages:
    43
    Location:
    Japan
    I recently read that this is perfectly sane and stable to attempt with 4GB or more.

    Just to mention....
     
  5. Ethan W

    Ethan W Member

    Joined:
    Jan 13, 2011
    Messages:
    1,711
    Location:
    NSW, 2155
    In that case, I'll give it a go on my old MBP with 8GB and an SSD and report back.
     
  6. nitro_jawt

    nitro_jawt Member

    Joined:
    Dec 11, 2004
    Messages:
    332
    Location:
    Melbourne
    I've just tried this on my 2011 MBP with 8GB Ram - worked great. Fired up a VM running Window 8 (2.5GB), Word 2011 with a 30 page doc, Outlook 2011, Safari with a bunch of tabs, Aperture with my normal library, and few other bits and pieces. That pretty much used up all RAM, but no issues. Will give it a proper go tomorrow :)
     
  7. |BeFoRe|

    |BeFoRe| Member

    Joined:
    Feb 3, 2006
    Messages:
    202
    Location:
    G-Town, Vic
    late 2012 mac mini 16gb ram and enabled this and have noticed a slight improvement while doing daily tasks.

    still got the standard 1tb hdd installed maybe i would see blazing results if/when i put in an SSD
     
  8. frupert

    frupert Member

    Joined:
    Aug 17, 2006
    Messages:
    18
    You will see speed improvements from this, but it still doesn't fix the fact that MacOS memory management is completely broken. another way to get your RAM back is by using the purge command.

    That seems to speed things up for me(stops MacOS from putting so much into page as it sees more free memory once it has been released.).

    I played with these settings for a while but gave up - my MacBook Air with a dual core and 4GB of RAM with SSD was magnitudes faster than my iMac Quad Core with 16GB RAM and a 1TB drive because the Air had an SSD... Since then I moved to a Retina MacBook Pro and it is so much quicker. I'm going to install an SSD and 32GB into the iMac and hopefully use it as a server now.
     
  9. OP
    OP
    Bifurcator

    Bifurcator Member

    Joined:
    Aug 13, 2012
    Messages:
    43
    Location:
    Japan
    What's broken about MacOS memory management? Anything specific you know of or care to share? :)

    Here's Purge for those wondering what it does:


    purge(8) BSD System Manager's Manual purge(8)

    NAME
    purge -- force disk cache to be purged (flushed and emptied)

    SYNOPSIS
    purge

    DESCRIPTION
    Purge can be used to approximate initial boot conditions with a cold
    disk buffer cache for performance analysis. It does not affect anony-
    mous memory that has been allocated through malloc, vm_allocate, etc.

    SEE ALSO
    sync(8), malloc(3)​


    I think this is kind of the opposite of what I'm doing by turning off the dynamic pager. Basically what I'm doing is keeping OS X from flushing all that good fast cache data. ;) By keeping it in ram which is faster (because of almost no seek speed) performance is enhanced and the I/O buss is more often (almost continually) in a relaxed state. The later not only reduces drive chatter (lengthening drive life) but also then when user accesses are requested it doesn't need to wait for the OS to finish before performing the request.

    With Purge you're dumping all that wonderfully fast cache and starting over. This could be good if your cache is nearing the system's RAM capacity and you need to suddenly do thousands of small I/O tasks but otherwise I'm not sure why Purge would speed anything up for you.


    .
     
    Last edited: Feb 27, 2013
  10. Paronga

    Paronga Member

    Joined:
    Sep 27, 2006
    Messages:
    1,406
    Location:
    Morrabbin, Victoria
    the idea that the memory management is OsX is shit because you never have free ram is nonsense and a really old idea. People obsessed with having as much free ram as possible need to get a grip.

    Empty ram is wasted ram. Let the OS fill it up with as much as possible. Trust the OS engineer to manage ram better than you.

    SSD makes a computer quick because it can fill the ram with app/data faster. If you have 32GB ram and slow disk, you're going to be waiting a long time to fill that ram.
     
  11. shift

    shift Member

    Joined:
    Jul 28, 2001
    Messages:
    2,937
    Location:
    Hillcrest, Logan
    But it makes perfect sense; just like only ever filling your fuel tank half way so you've always got heaps of room for more fuel.
     
  12. Paronga

    Paronga Member

    Joined:
    Sep 27, 2006
    Messages:
    1,406
    Location:
    Morrabbin, Victoria
    w....what?
     
  13. munchkin1

    munchkin1 Member

    Joined:
    Jun 6, 2010
    Messages:
    4,373
    Yeah...wtf... :confused:
     
  14. Paronga

    Paronga Member

    Joined:
    Sep 27, 2006
    Messages:
    1,406
    Location:
    Morrabbin, Victoria
    i think (hope) it's sarcasm to reinforce my point which is it's silly to have 'free space' whether it's ram, fuel tank, bank account etc.
     
  15. shift

    shift Member

    Joined:
    Jul 28, 2001
    Messages:
    2,937
    Location:
    Hillcrest, Logan
    I'm sorry, I'll try again.


    SARCASM
    But it makes perfect sense; just like only ever filling your fuel tank half way so you've always got heaps of room for more fuel.
    END SARCASM
     
  16. Lukenet

    Lukenet Member

    Joined:
    Oct 4, 2002
    Messages:
    535
    Location:
    Brisbane
    I dont get it! Are you trying to be sarcastic or something?
    Maybe you should just spell it out or something..
     
  17. Mac-Pro

    Mac-Pro Member

    Joined:
    Feb 27, 2010
    Messages:
    171
    Just reporting a problem. I ran this script on 2 notebooks and it created a problem where the icons in the tool bar and finder disappear when waking up from sleep.

    The way to resolve this is to make a time machine backup, then reinstall the OS and restore from time machine.

    About to reinstall the 2nd notebook now.

    I do not recommend the running of the above scripts for machines that require sleep mode.
     
  18. Dark Passenger

    Dark Passenger Member

    Joined:
    Dec 3, 2010
    Messages:
    1,020
    Location:
    I'm not telling
    bugger I always sleep my laptop i cant remember when it was turned off for any period of time.
     
  19. Mac-Pro

    Mac-Pro Member

    Joined:
    Feb 27, 2010
    Messages:
    171
    Oh I forgot to mention to run

    before running the time machine backups for restoration.
     
  20. |BeFoRe|

    |BeFoRe| Member

    Joined:
    Feb 3, 2006
    Messages:
    202
    Location:
    G-Town, Vic
    I found holding down the Shift key during boot, then once loaded up a reboot fixed my issue of the dock not loading & finder thingy refusing to work properly.

    although i did leave the mac mini sleep for like 3 1/2 days then upon starting it up it was not working properly.
     

Share This Page