Applications load slower on first launch

Discussion in 'macOS' started by wesleyh, Mar 24, 2007.

  1. wesleyh macrumors 6502

    Mar 23, 2007
    This is because the application has not yet been cached in RAM. If you quit (completely) and then start again, it loads much faster.

    Now for my question, is it not possible to, say when you shut down the computer, write this ram cache (for certain applications) to disk and then read it in the ram at startup so that these applications will already load faster?

    Or some sort of default state that can be written to disk and then copied to ram at startup?

    Is this possible at all, or something similar to it?
  2. TheAnswer macrumors 68030


    Jan 25, 2002
    Orange County, CA
    The easiest solution is the just sleep your computer without logging out instead of shutting it down. There might be other solutions out there, but I'm guessing they will probably negatively effect your startup time.
  3. wesleyh thread starter macrumors 6502

    Mar 23, 2007
    Ya well, I always shut the computer down (to conserve energy amongst other things)
  4. SpookTheHamster macrumors 65816


    Nov 7, 2004
    More often than not, putting your computer to sleep uses less energy than turning it off and then turning it on again.
  5. ElectricSheep macrumors 6502


    Feb 18, 2004
    Wilmington, DE
    Doing as you described on a per-application basis would be a challenging problem from a sofware engineering standpoint. Part of the reason that applications relaunch so much faster is that any dynamic libraries that they reference have already been loaded into memory by the kernel. These libraries then only have to be mapped onto the virtual address space of the application without re-loading the library from disk.

    There are other problems involved with just loading an application image to pick up where you left off. Was the application using any devices? What state were they in, and do they have to be re-initialized? Was the application using any Mach-Ports for Inter-Process Communication? What about portions of the application's memory that might have been shared with another application via memory-mapping?

    In the end, the amount of time and resouces an operating system spends checking for these conditions could outweight any benefits garnered from reading back an 'application cache'.

    What is possible is a 'full-system replay' feature. This is already implemented with the Safe-Sleep functionality included with Tiger. With Safe-Sleep, the state of the entire system--kernel and all--is saved to the disk as a complete memory image. The system then powers off instead of going to sleep. Pressing the power button causes the system-state to be restored from the memory image, and you can pick up right where you left off.
  6. EvryDayImShufln macrumors 65816


    Sep 18, 2006
    Sleep is awesome and will result in an ultra-performing computer all the time.

Share This Page