Thursday, September 19, 2024

Performance Improvements in Flash Player 8

Maybe it’s not as sexy as alpha video or a drop-shadow filter effect but the improved performance of Macromedia Flash Player 8 is a feature you can immediately benefit from-without doing a thing.

One of the biggest contributors to the overall performance boost is the new garbage collection scheme, which improves ActionScript execution while reducing player memory usage.

Additionally, several changes to Flash Player 8 that are specific to the Macintosh platform result in greater parity between Windows and Macintosh performance. With these changes, you could see up to a 50% increase in the overall performance of Flash Player 8 when viewing content and applications.

Big Boost from the New Garbage Collector

The new garbage collector in Flash Player 8 is the main driver of performance boosts in ActionScript execution and reduced memory usage. As the size and complexity of Flash applications increased, we were starting to reach the limits of the reference-counting algorithm used for garbage collection in Flash Player 7. By switching from simple reference counting to deferred reference counting, we eliminated over 90% of the reference counting in Flash Player.

The overhead for reference counting in Flash Player 7 was approximately 20% of total execution time, which often resulted in rendering pauses for large applications. The new garbage collector reduces this overhead to only 1-2% of total execution!

Flash Player 8 also uses incremental garbage collection, which breaks up the operations for marking objects for deletion and the actual deletion step so that they can be run whenever there is a free cycle.

Because efficient garbage collection and memory usage are directly related, Flash Player 8 uses approximately 50% less memory than Flash Player 7. The garbage collection method used in Flash Player 7 resulted in almost linear use of memory. By contrast, using incremental garbage collection, the memory usage in Flash Player 8 performed more like a step function as chunks of memory were freed periodically during free cycles.

For the same test on Mac OS X, the garbage collection performed slightly differently: Flash Player freed memory mostly at the end. As a result of the new garbage collector and lower memory consumption, most of your existing content should experience some improvements in speed when running in Flash Player 8-without any recompiling.

Yes, You Can Create a Movie That Runs Slower in Flash Player 8

Although the overall performance of your content and applications will improve, the new garbage collector has some performance side-effects for specific areas. Some operations will be faster, while others will be slower when compared to the same operations in Flash Player 7. This is because the underlying infrastructure for supporting memory management has changed. As a result, microbenchmark tests, or small benchmark tests that measure a particular aspect of functionality, cannot really be used for an apples-to-apples comparison between older player versions and Flash Player 8.

For example, let’s say you have a microbenchmark test that calculates an equation to exercise some math routines, and you run it five times in a row in the player. In Flash Player 7, it takes 300 milliseconds to calculate. That individual test will also take 300 milliseconds on each subsequent run. With the garbage collection in Flash Player 8, this same microbenchmark test might take 310 milliseconds the first time, 300 milliseconds the next time, and so on. The first time might be slower than in Flash Player 7 but subsequent runs would run faster, resulting in an overall average that is faster than Flash Player 7.

See a set of our sample Flash Player microbenchmark tests and results at the end of this article. The primary goal for performance is to improve overall application performance, not necessarily improve each individual microbenchmark. Microbenchmark tests are useful to us for checking that we aren’t setting things back with the changes we make, but the important thing to note is that we have also added reference application benchmarks to our test suite for more complete testing of how overall performance is impacted.

Keeping It Real on the Mac

With this release, we focused a significant amount of time and energy on player performance on the Mac to bring greater parity between Windows and Mac OS performance across all aspects, as well as increase stability. One of the big moves was rewriting the Mac plug-in to use the new “Mach-O” OS X runtime architecture, which allows the player to take advantage directly of the new technologies and features of the platform. We also spent a lot of time optimizing the core rendering routines specifically for the Mac.

To improve playback of video and large content and lower CPU usage, Flash Player 8 uses some OpenGL features when run in Safari on Mac OS X 10.2 and above. This is not full support of OpenGL; the player takes advantage of specific features to get bits on the screen faster. Using OpenGL improves video playback and animation, and reduces tearing or horizontal redraw lines.

Similar to the change in garbage collection, this feature improves the overall performance of rendering in Safari; however, in some cases performance may decrease. OpenGL also has some built-in limits and on older, slower systems Mac OS X will cap the frame rate to 30 frames per second. Why is it Safari only? The feature requires the browser to notify the player when a user creates a new tab or switches tabs, and at the time of this release Safari was the only Mac browser capable of supporting this feature.

Sample Flash Player Microbenchmark Tests and Results

The following Sample Flash Player Microbenchmark Tests and Results are provided as an illustration of the types of performance tests Macromedia runs during the development of the player:

Tests results are from August 30, 2005, with Flash Player 7r19 and Flash Player 8r22 stand-alone players.
Time is measured in number of milliseconds. Percent change uses Flash Player 8 as the reference point, such as “Flash Player 8 is 51.5% faster than Flash Player 7 for the Boids test on Windows.”
We used the following reference machines:

Mac OS 10.3 – 800 MHz – 256 MB RAM (1 CPU disabled on dual processor machine)
Windows XP SP2 – P3 1 GHz – 384 MB RAM
32-bit resolution (no other applications running, no mouse movement, no special priority setting on process)
Sample Flash Player Microbenchmark Tests and Results

Where to Go from Here

Obviously, this is not a comprehensive list of performance enhancements that affect specific player features. Many changes and optimizations are deep under the surface, such as changing underlying internal data structures to use less memory or using floating-point matrices to improve rendering accuracy. Some enhancements make specific functionality faster, while others might make performance trade-offs in order to support cool new functionality. When taken as a whole, the overall effect of the performance features and optimizations in Flash Player 8 makes for a smoother, faster experience for your content and applications.

To learn more about Flash Player, visit the Flash Player Developer Center.

To learn more about Flash Player 8 features, visit the Flash Player Features page.

Emmy Huang is Senior Product Manager for Flash Player.
Her experience includes working in engineering and product
management on a range of digital entertainment technologies
at Sony Pictures Digital, Liberate Technologies, and
Intel. She briefly flirted with the idea of switching
to another industry while working towards her MBA at
UCLA, but decided that working in software was way more
fun than selling bleach.

Related Articles

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles

Buy new construction florida home.