[X-Newbies] optimizing System Performance
Alex
lists at lexial.ca
Sun Apr 17 09:20:34 PDT 2005
On Apr 17, 2005, at 1:55 AM, Cyril Blanc wrote:
> After MAC OS X has install an APP, you have a message that it is
> "optimizing System Performance"
>
> What is it doing ?
Updating the prebinding information. In Apple's words:
"The Apple installer application performs an optimization step
at the end of an installation. This optimization step looks at
the applications on the boot partition and updates their
prebinding information to match the current system
configuration."
What is prebinding? Apple again:
"Prebinding is the process of computing the addresses for symbols
imported by a framework or application prior to their use.
Resolving these addresses before their use reduces the amount of
work performed by the dyld tool at runtime and results in faster
launch times for applications."
In a nutshell, on Mac OS X, prebinding makes applications launch faster.
Here's the long story, in severely simplified, non-techspeak language.
Let's say John writes an application which, among other things, needs
to calculate the square root of a number. So he writes a segment of
code (a subroutine) which does this task. And let's say Peter writes
another application, different from John's, but which also needs to
calculate the square root. So Peter writes a subroutine to handle this
task. This wastes resources -- for instance, if you run both apps at
the same time, you use up memory twice loading two different
subroutines which do the same thing. A better way of doing this is to
put the subroutine which calculates the square root in a separate
container (a reusable code library), supplied with the operating
system. This way, neither John nor Peter have to waste their time
writing a square root calculation routine; they just have to tell their
applications to use the subroutine from the library; and when the
applications are launched (executed) the library needs to be loaded in
memory only once.
But what if the library contains, in addition to square root, many
other functions? Then the application will have to be told where to
find the square root in the library -- in other words, the square root
function's address. But what if the library is changed, say, by
replacing it with a new, improved version? Then the application will
find the wrong code at the specified address, and it will crash or
generate an error. A better way is to specify, instead of an address, a
symbol, such as a name. So, instead of blindly executing code found at
a particular address, the app will first look for the address
corresponding to that symbol, and then execute it, thus making sure it
executes the right code.
But what if there are many libraries, each with many functions? Every
time an application launches, it will have to spend a lot of time
matching subroutines and addresses -- in other words, binding a symbol
to an address. But most of the time, this is not necessary, because
libraries don't change that often. So the time it takes to launch an
application can be shortened considerably by making a list of
addresses, and using that predefined list, until one of the libraries
changes. In other words, by prebinding. This is what the Apple
installer does when it's "optimizing system performance".
> So what is the need for applications like MOX that also "pre-bind" ?
Mostly, there isn't; at least, there hasn't been since 10.2. Of course,
prebinding fails if the system configuration changes, and the Mac OS X
installer optimization process itself has a number of limitations (e.g,
it only prebinds applications on the boot volume). But the operating
system detects when an application with outdated prebinding info is
launched, and eventually it runs a faceless application called
fix_prebinding, which attempts to fix that app's prebinding data, if
possible. (Not all applications can be prebound.) So an application
which fixes prebinding is useless for the overwhelming majority of
users of Mac OS X v10.2 or later; the small number of users -- mostly
developers -- who need it already know that the OS provides two tools
for this purpose: redo_prebinding and update_prebinding.
Why would an application provide this function? Here's Tom Harrington's
(developer of Macaroni) opinion:
<http://www.atomicbird.com/node/view/41>
For more on prebinding, here's a useful (IMHO, of course) link.
<http://radio.weblogs.com/0100490/stories/2002/08/24/
prebindingExplained.html>
You'll find more info on Mac OS X maintenance and troubleshooting
(including prebinding) here:
<http://www.thexlab.com/faqs/maintainingmacosx.html>
As for MOX Optimize, I'm not a fan at all. There are plenty of, IMHO,
better applications for the job, such as
Cocktail <http://www.macosxcocktail.com/>
Macaroni <http://www.atomicbird.com/?q=>
Onyx <http://www.titanium.free.fr/pictures/onyx.gif>
TinkerTool System <http://www.bresink.de/osx/TinkerToolSys.html>
and others.
<0x0192>
More information about the X-Newbies
mailing list