Saturday, September 20, 2008

Microsoft's PGO really improved my Program

My project for OSD is to investigate bugs and crashes in Firefox when it has been built using profile guided optimizations.

Working with PGO
I am unfamiliar with pgo's so I decided to use it on one of my old class assignments. First a program is built to include extra code to monitor the activity in the program and spit out a file with possible optimizations. To best optimize the program, the program should be run through multiple scenario's to generate more files with optimizations for the program. Then all the optimizations are to be merged into the program to created an optimized build. Of course there are many options to choose what to optimize and what optimizations should be merged.

The Optimize Program
I choose to test my assignment from my course Data Structures and Algorithymes.

The excerpt below is from my Project Page.

The program loads 15,000 random records from a text file into 4 tables each using a different method for storage and searching.
  1. Simple Table: Uses an array and a linear search.
  2. Chain Table: Uses an array of link lists. Search is done with a Hash Key.
  3. Hash Table: Uses an array and searches with linear probing. Also uses a Hash Key.
  4. Tree Table: Uses a binary search tree.
After the data is loaded into a table, 30 different tests are run against it. The same 30 tests for each table. Here are the Results.

Non-PGO PGO Improved By
Simple Table: 28 Secs 4 Secs 7x
Chain Table: 0.109 Secs 0.047 Secs 2.3x
Hash Table: 0.141 Secs 0.047 Secs 2.3x
Tree Table: 0.287 Secs 0.078 Secs 3.6x



I'm very impressed with the results. I tried to look at the files to see if I could determine what it decided on optimizing but of course it is in some machine language I don't understand. Probably references to memory locations and such.

So I'm still not sure how to tackle my project. I think I'll mess around with the PGO settings and other optimizations. I can also do this from the command line with I might try. I'll need to talk to ted on IRC or someone about how to compile with pgo and debugging it.

No comments: