Getting Started with Performance

Technology Overview

Performance is the measure of how efficiently your software uses resources such as the CPU, memory, and hard drive. Improving performance involves establishing a set of target goals and then measuring the efficiency of your software against those goals. Apple provides tools for measuring your software efficiency in several different ways. Using your measurements, you can then decide an appropriate course of action for modifying your code and meeting your goals.

There are many ways to improve software performance, but not all of them are appropriate for every situation. Diagnosing performance problems requires some detective work on your part, but Apple’s performance tools can help you in this endeavor. With these tools, you can gather information such as the following:

  • Where time is being spent in your code

  • Whether your application is leaking memory

  • How much memory your application consumes

  • Where your application is drawing to the screen needlessly

  • Where files are being accessed

  • Whether your application is polling the system

From this and other information, you can identify reasons why your application does not match your performance goals and proceed with fixing those problems.

Start Here

Before you attempt to fix any perceived performance problems in your software, you should read:

Choose a Learning Path

If you’re just starting a new programming project, your designs should take performance into account. If you’re improving the performance of an existing program, you want to find the bottlenecks in your code. If you’re looking for peak performance, you want to tune it for specific hardware.

Designing for Performance

Before you can build performance into your code, you need to understand what is meant by performance. There are many ways to measure performance, but not all of them may be relevant to your application. Knowing which performance metrics are important to you can heavily influence design decisions.

The document Performance Overview contains information related to designing your application with performance in mind. For an introduction to the factors that make up performance, read the chapter Developing for Performance.

Improving Your Existing Code

Diagnosing performance problems requires real data and not guesses. Apple’s performance tools provide metrics that you can use to identify potential problems. For some specific problems, there are also ways to take advantage of multithreading and Velocity Engine to improve performance.

  • If the launch time of your application seems slow, your code may be doing too much work when it launches. To learn how to trim your launch-time code to the smallest working set, read Launch Time Performance Guidelines.

  • If your application performs operations that could run in parallel, use additional threads to improve your application’s perceived responsiveness. For an overview of available threading models, read Technical Note TN2028, Threading Architectures. For information on how to use threading interfaces, read Threading Programming Guide.

  • If your application performs complex math or image calculations, use the vImage and vDSP libraries to speed up operations using Velocity Engine. To learn how to use the vImage library, read Optimizing Image Processing With vImage. To learn how to use the vDSP library, read vDSP Library in Performance Documentation.

  • If your code seems to slow down as the working data set gets larger, your algorithms may not be tuned properly. To learn how to improve the efficiency of your algorithms, read Code Speed Performance Guidelines.

Tuning Code for Specific Hardware

Hardware optimization is one of the last steps for developers who need to maximize the performance of their applications. To optimize for specific hardware, you’ll learn how to use the CHUD tools and optimize for the target processor.

  • If your application is slow on specific hardware, you use the CHUD tools to gather hardware-related metrics. To learn about the CHUD tools, read the article Performance Tools in the document Performance Overview.

  • If want to maximize performance on the Power Mac G5, read Technical Note TN2087, PowerPC G5 Performance Primer and Technical Note TN2086, Tuning for the G5: A Practical Guide.

  • If your application needs to address more than 4 GB of memory, write your program for a 64-bit architecture. To learn more about writing 64-bit programs, read 64-Bit Transition Guide.

Next Steps

The Performance Reference Library includes the following high-level Performance resource pages, which can be bookmarked for easy access:

  • Guides

    Conceptual and how-to information for performance.

  • Reference

    Focused, detailed descriptions in reference format for performance.

  • Release Notes

    Late-breaking documents on issues related to performance.

  • Sample Code

    Sample applications demonstrating a variety of performance techniques.

  • Technical Notes

    Late-breaking documents on performance issues.

  • Technical Q&As

    Programming tips, code snippets, & FAQs by Apple’s support engineers.

© 2003, 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-12-05)

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.