Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Apple > Operating Systems

This chapter is from the book

Maximizing Performance

Most computer users are never completely satisfied with how fast their computers run. They could always be faster. Although the hardware and software place certain limits on how fast a computer can go, a computer often runs slower than it is capable of doing. In this section, I describe some ways to make sure that you are getting the best performance from your Mac.

As a starting point: A native Mac OS X program running in Mac OS X should run about as fast as a Mac OS 9 version of the same program would run in Mac OS 9. A Mac OS 9 program running in Classic, while booted from Mac OS X, will generally be slower than the same program running in Mac OS 9.

Otherwise, if your Mac appears to be running significantly slower than it typically runs, or just runs too slowly in general, consider the following techniques.

SEE

"Technically Speaking: Monitoring and Improving Performance," later in this chapter, for other ways to enhance the speed of your Mac and for how to monitor memory use.

Not enough memory

Due to Mac OS X's dynamic memory, you will rarely, if ever, see "out of memory" messages, no matter how many applications you have open. Thus, it may sometimes appear that your Mac has unlimited memory. This is not so. At some point, as you open more and more applications, the overall performance of every aspect of your Mac will slow. Keep pushing the memory envelope, and you will likely precipitate a crash. Following are two solutions:

Add more memory. The best solution to memory problems is to purchase more memory. How much? As much as you can afford or your Mac can hold. You can't have too much. Mac OS X devours whatever RAM you give it. And the less RAM you have, the more performance slowdowns you will have.

Quit unneeded applications. If you are not adding more RAM, the more immediate alternative is to quit any open applications that you do not need. Quitting Classic, if you don't need to use it, is always good advice. In some cases, if a problem has become severe, you may need to log out and log back in before performance improves.

Different programs use different amounts of memory. Thus, quitting application A may have little effect, whereas quitting application B may have a tremendous effect.

About This Mac. How do you know how much memory you have and how much you are using? The About This Mac window, which you open from the Apple menu, tells you how much physical memory (RAM) you have installed.

SEE

Chapter 4 for more background on dynamic memory and related Darwin issues.

Too slow a processor

If your Mac is more than two years old, getting a new Mac will likely give you significantly better performance. Upgrading the processor or graphics card on your existing Mac may be a more cost-effective solution.

A Mac with a PowerPC G4 processor, for example, will be noticeably snappier than one that uses a PowerPC G3. Presumably, PowerPC G5 processors will be faster still. The difference in processor speed usually is more noticeable when you're running Mac OS X than it is in Mac OS 9, as Mac OS X places more demands on the processor. Mac OS X also includes dual-processor support for OS functions; Mac OS 9 did not. So if you have a dual-processor Mac, it should seem faster in Mac OS X than it does in Mac OS 9.

A faster graphics card (ATI and nVidia are always coming out with new and improved models) can also enhance speed, especially when you're using multimedia or playing games.

Not enough free space on the drive (especially for the swap file)

If your hard drive is nearing capacity (generally, for most current hard drives of 10 GB or larger, if you have less than 1 GB of unused space), you may start to see a performance decline.

Too little free hard drive space is a concern especially when the size has become so small as to present problems for maintaining the virtual-memory swap file. Mac OS X's virtual-memory system works by storing information on your hard drive in a file called a swap file, located in the invisible /private/var/vm directory. This file can be quite large—80 MB at minimum. With too little free hard-drive space to accommodate the growth of the swap file as needed, you will start to see a performance decrease. Actually, even with a minimally sufficient amount of space available, fragmentation of the swap file can lead to a performance decrease.

The common solutions are:

  • Reduce the need to access virtual memory by decreasing the number of processes/applications you have running at one time.

  • Add more physical memory.

  • Delete unneeded files from your hard drive and defragment your hard drive to make more contiguous free space. (See "Insufficient space," earlier in this chapter, for some specific advice.)

  • Purchase a larger hard drive to replace your existing one or as an additional drive to offload rarely used files. Newer hard drives also tend to be faster than their older predecessors.

TECHNICALLY SPEAKING

Moving the Swap File to a Separate Partition

A hard drive becomes fragmented when a file is stored in several segments in different locations on the drive, typically because no single free section of the drive is large enough to hold the entire file as one segment. As more files become fragmented, the overall level of disk fragmentation increases. If the fragmentation level gets sufficiently high, drive performance can start to decline. Disk optimizers such as Norton Utilities' Speed Disk are designed to reduce this fragmentation.

Larger files are more subject to fragmentation than smaller ones. As the swap file is a large file, it is especially vulnerable to fragmentation. Moving the swap file to a separate volume (presumably, one with lots of free space) from the one that contains Mac OS X can help reduce fragmentation. This change may in turn improve virtual-memory performance as well as disk performance.

I am still not convinced that the benefit is worth the effort. But if you want to give it a try, a utility called Swap Cop automates the procedure for you. Otherwise, the procedure, which requires considerable work in Terminal and with Unix files, is beyond the scope of this book. If you want the details, see ResExcellence (www.ResExcellence.com/hack_html_01/06-01-01.shtml) or Mac FAQs and Tips (www.bombich.com/mactips/swap.html).

SEE

"Technically Speaking: Monitoring and Improving Performance," later in this chapter, for more information on memory and the swap file.

Too slow an Internet connection

If your speed problems are primarily restricted to online problems (such as slow loading of Web pages), and you have a dial-up modem connection, it's time to think about moving up to a broadband connection (cable or DSL). Your speeds be much faster, and you will have a 24/7 connection with no need to log on and no dropped connections.

If you already have a broadband connection, you can still do some things that may improve performance. The utility MOX Optimize, for example, includes an option to speed Ethernet networking by optimizing buffers. This option essentially simplifies doing what you could otherwise do in Terminal.

SEE

Chapter 8 for more information on Internet issues.

Figure 6.45Figure 6.45 MOX Optimize's Network tab.


Miscellaneous other tips

Finally, you can do a host of other minor that have a small incremental effect on performance. These techniques mostly involve turning off certain Finder and Dock features, thereby reducing the CPU usage. It's up to you to decide whether the tradeoff is worth it. You could turn off the following features:

  • Dock magnification

  • Zoom rectangles

  • Text antialiasing

  • Window shadows

  • Bouncing icons in the Dock (which can slow your Mac considerably)

You can do all these things via one or more of the following: Finder and Dock Preferences settings, TinkerTool, ShadowKiller, MOX Optimize, Dock Detox, and a host of other shareware utilities. MOX Optimize has an especially rich selection of options, including the capability to increase the Finder's Unix nice priority (see "Technically Speaking: Monitoring and Improving Performance" later in this chapter).

Quit Sherlock. Don't leave Sherlock running if you are not using it, especially if you have enabled its option to index volumes and folders. On one occasion, my Mac slowed down to the point that I could barely use it. When I ran the top command in Terminal, I discovered a process called ContentInd (presumably from Sherlock) was monopolizing almost all of the CPU usage. Quitting Sherlock, if you can, might put an end to this. I chose instead to use the kill command in Terminal (see "Kill from Terminal" in Chapter 5) to kill the process. This immediately eliminated the slowdown.

Check the Web. Various Mac Web sites have posted additional tips for enhancing Mac OS X performance. One good example (beyond my own MacFixIt) is Mac OS X FAQ (www.index-site.com/Macosxspeed.html).

TECHNICALLY SPEAKING

Monitoring and Improving Performance

Insufficient memory, too slow a processor (CPU), a nonoptimized drive—all these things (and more) can decrease the performance of Mac OS X. But if you suspect that your Mac is not up to par, how would you determine which, if any, of these factors is the major cause? And beyond adding hardware (such as more memory or a faster processor), what, if anything, can you do to improve performance? The answers to both of these questions reside in a host of utility software. Some solutions require using Terminal; others are Aqua-based. Following is an overview.

CPU Monitor. CPU Monitor, which is included when you install Mac OS X, is located in the Utilities folder. When you launch it, the program displays a small thermometer-type gauge, with a current level that keeps rising and falling. The level indicates the ever-changing extent of CPU use. Don't be alarmed if the level occasionally gets to 100 percent; that's OK as long as it doesn't stay there for a sustained period. If the gauge remains at its peak, you are likely trying to do too many processor-intensive activities at the same time. Quitting some applications or reducing how many tasks you have going simultaneously will likely help. I have rarely found this gauge to be diagnostically useful. But the CPU Monitor Processes menu also serves as a convenient launch pad for two more-useful functions: Process Viewer and top.

ProcessViewer. ProcessViewer is also part of the basic Mac OS X installation. I have discussed this utility before, primarily in Chapter 5, as a means to force-quit processes. Now I want to focus on two additional features of the utility: its %CPU and %Memory column listings. Each process listed in ProcessViewer's display has a value in each of these two columns. These values indicate how much CPU attention and memory availability the process is using. You can sort either column by clicking the column name. If you do so, the processes that move to the top are the ones that are the most likely culprits in any CPU- or memory-related performance problems. In general, regardless of what the results may be, do not quit any processes that you do not recognize, especially administrative processes. If a process name is for an application you do know, its CPU or memory percentage remains high, and you don't need it open at the moment, quitting that application would be a good idea.

One difficulty is that all Carbon applications will have the name LaunchCFMApp, making it dif-ficult to tell which one represents a particular Carbon application. Similarly, Classic applications are not listed separately but are included under the TruBlueEnvironme process. You may need to do trial-and-error guesswork to figure out the culprit.

Also note: Some applications may claim to be using 0 percent of memory. This can happen; it does not mean that something is wrong.

Terminal commands. You can view (and, in some cases, modify) a variety of important performance measures via Unix commands you enter in Terminal. Following are some examples:

  • top. If you choose the top command in CPU Monitor, it will launch Terminal and execute. You can also get there simply by launching Terminal and typing <top>. The top display is Unix's version of ProcessViewer. The PID column, for example, gives the Process ID number for a process, the Command column gives the name of each process, and the %CPU gives current CPU use. The numbers continue to update as you watch. To exit this display, type

    <q> (for quit).

    NOTE

    Note: Unlike ProcessViewer, Terminal does not list the names of all Carbon applications as LaunchCFMApp.

    At the top of the top display are some other important numbers. Load Avg is one indication of CPU use. The three numbers represent the most recent average and two averages from minutes before. Generally, the load should stay below 2.0. If it gets higher and stays there, and if performance slows, you may be trying to do something beyond what the processor can handle. If what you are trying to do is essential to your work, an upgrade to a faster processor may be required. Otherwise, you need to try to do less at the same time.

    The CPU Usage numbers give a different perspective on how the CPU is being used. These numbers indicate how much of the CPU is allocated to the system (kernel) vs. the user vs. how much is not currently being used at all (idle). Be especially on guard as the idle percentage approaches 0, which is likely to correlate with performance slowdowns.

    Finally, the VM (virtual memory) line gives an indication of memory use. The VM line looks something like this:

    VM: 3.19G + 50.7M 25092(0) pageins, 24969(0) pageouts 

    If the initial number (3.19 GB in the preceding example) is getting close to the size of your remaining free hard-drive space, you are likely to see performance slowdowns. This number indicates that your swap file does not have sufficient space. (Note: The amount of free space on your volume is listed in the status bar of any Finder window for that volume, assuming that Show Status Bar was chosen from the Finder's View menu.) For further details on memory use, read on.

  • vmstat. Unix's vmstat command provides a more focused look at Mac OS X's memory use than top provides. Of particular interest is the number of pageouts (also listed in the top display). The pageout value is an indication that physical memory is being paged (swapped) to the swap file on your drive. The higher the number of pageouts, the greater the disk access and the worse your performance is likely to be. A performance problem is especially indicated if you see pageouts continuing to increase over time.

    If pageouts equal 0, you are not using the swap file at all. This situation is the ideal, as any use of the swap file will likely result in slower performance. As long as the pageout number is near 0 and relatively stable, you need not be too concerned about memory use, even if other statistics indicate that your memory use is at or near 100 percent.

  • renice. As I discussed earlier in this book (see "Darwin" in Chapter 4), Mac OS X's preemptive multitasking attempts to allocate the processor's attention such that the most important tasks get the most attention (generally giving greater attention to a foreground application over a background one, for example). Tasks that get the greatest attention complete the fastest. One way the OS makes these decisions is by assigning each process a priority ranking. When two processes are competing for the CPU's attention, the one with the greater priority will receive the greater attention.

    On occasion, however, you may want to override the OS's default priorities. Some users have found they can give Virtual PC a needed speed boost by assigning a higher priority to it. To do this, you use Terminal's renice command. The default nice level for most applications is 0. The potential range is between –20 and +20. To increase an application's priority, you lower its nice level from 0 to a lower number. (The lower the number, the more attention a process gets.) There are limits, of course. If you give everything a score of -20, for example, you won't be increasing the performance of anything. The benefits are always relative to the priorities assigned to other processes.

    To change a nice value, type <sudo renice {nice #} {pid}>, in which where {nice #} is the integer from –20 to +20 and {pid} is the process ID number of the process you want to change. (You can determine a process pid from the top command or from ProcessViewer.) Unfortunately, these changes may not be saved after you quit the application or restart the Mac. So you may need to reenter a change each time you use the application.

    By the way, users have noticed that Virtual PC runs slower in Mac OS X than it does in Mac OS 9. Connectix claims that this slowdown is due to a rare case in which preemptive multitasking (used in Mac OS X but not Mac OS 9) turns out to be a disadvantage. In Mac OS 9, Connectix can make sure that Virtual PC gets as much processor priority as possible. In Mac OS X, preemptive multitasking prevents this situation, resulting in slower performance. An upgrade to Mac OS X is supposed to provide a workaround for this situation.

  • Optimize (update_prebinding). When you run a Mac OS X update via the Installer utility, at some point, the Installer typically says that it is optimizing the software. This process often turns out to be the longest part of the entire update.

    What the Installer is doing at this point is running the Unix update_prebinding command. To explain the process in the most nontechnical language possible, the command updates the linking among applications and the shared library files that may be required to run an application. Whenever a new application is installed, this information map needs to be updated. If the information is not updated, the resolving of these links is calculated when you launch the application, which takes added time and thus slows performance. Installers perform this task because, following the installation of new software, updating this map is desirable.

    If you add applications to your drive by any method that does not do this updating (which would be the case for most applications that do not use Apple's Installer utility), running the update_prebinding command yourself could increase the speed of Mac OS X.

    The simplest way to do this is to bypass Terminal and use Xoptimize, an Aqua-based utility that accesses the same update_prebinding command. Xoptimize also includes options (such as using less memory when running the optimization) that can prevent problems that might occur if you simply ran update_prebinding from Terminal.

    NOTE

    Mac OS 9 users may be familiar with the term optimizing, as it refers to defragment-ing the files on a disk and optimizing their locations as done via a utility such as Norton Utilities' Speed Disk. This process is different from the Unix-based optimization referred to in this sidebar. You may still get benefit from using Speed Disk on a Mac OS X volume, but I confess that I no longer bother to do this. The process is not likely to be of much value if you have a large hard dive with a good deal of unused space. The issue did come up, however, when I decided whether to move the swap file to a separate partition (see: "Technically Speaking: Moving the Swap File to a Separate Partition" earlier in this chapter).

  • netstat. Terminal's netstat command gives you a quick indication of whether your network connection is performing up to par. In Terminal, type <netstat –i>. In the display that appears, if the incoming packet count is 0, you probably don't have a connection at all. If your error count is greater than 1 to 2 percent, there is likely to be some problem with your connection (perhaps a network difficulty at your cable company's end). Type <netstat -i 10>, and the display is updated every 10 seconds. This technique allows you to test hypotheses. You could start your browser to see whether the error counts change as the browser attempts a connection, for example.

Aqua-based utilities. Many Aqua-based utilities that measure performance are actually graphical user interfaces (or GUIs) for a Unix function otherwise accessed via Terminal. I have already mentioned some of the utilities, including ProcessViewer, CPU Monitor, and Xoptimize. Following are some others.

Perfboard is an Aqua-based shareware utility that provides a quick view of most of the data covered in this sidebar. In its default view, you get a constantly updated look at CPU percentage, system load, memory use (including pageouts), network ins and outs, and disk reads and writes.

Other Aqua-based utilities provide similar feedback—usually, a subset of what Perfboard provides, but in the form of a menu-bar item or a Dock icon. One example is GMem!, which shows memory use.

The Renicer and Nicer utilities allow you to modify the nice level of a process without using Terminal.

The Netstat tab of Network Utility (included in the Utilities folder of Mac OS X) offers similar functionality to Unix's netstat command.

SEE

  • "Optimize Mac OS X volumes," in Chapter 5.

  • Chapter 8 for more information on networking issues.

Figure 6.46Figure 6.46 CPU Monitor's Processes menu and CPU gauge.


Figure 6.47Figure 6.47 Process Viewer's display.


Figure 6.48Figure 6.48 The top command output viewed in Terminal.


Figure 6.49Figure 6.49 The vm_stat command output viewed in Terminal.


Peachpit Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Peachpit and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Peachpit products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email ask@peachpit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by Adobe Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.peachpit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020