View Single Post
Old 08-21-2004, 03:52 PM   #10
JimO'Connor
Mac Development
 
JimO'Connor's Avatar
 
Join Date: Jul 2002

Location: Kenai, Alaska
Posts: 678
Re: Performance numbers

Originally posted by johnblommers
This is so interesting I decided to characterize the performance of the Goldfish Aquarium (GA) application (not the screen saver). Here are the summary findings:

(1) In a 0-fish unpopulated tank, the frames per second (FPS) varies dramatically from 190 fps for a lush planting to an incredible 542 fps for a large clear tank. The amount of non-fish stuff in the tank is what impacts the performance most. This is the area ripe for optimization.
Drawing an empty screen (pond with no fish, debris off, bubbles off or large clear tank with same conditions) means just clearing the screen and drawing a grad fill rectangle. This takes some small number of milliseconds, requires almost no data be transferred to the video card, and requires the video card to do almost no work because we turn off depth testing, lighting, and most everything complicated to draw the background. This is like "while (true) ;" I have a debug build which outputs the average draw in milliseconds, including the extremes each second. Obviously this will vary between machines/monitors/build styles because of optimizations, etc, but it gives us hard numbers to compare.

.............................. Oreo ...... Jack .... Monstro
Tank ..... Empty .... 1 fish ..... 2 fish ..... 3 fish .... + bubbles ... + debris
Clear ..... 1.2 ms ... 3.0 ms . 3.7 ms ... 4.3 ms .... 4.8 ms ....... NA
Rocks .... 3.0 ms ... 3.5 ms . 4.0 ms ... 5.0 ms .... 6.0 ms ....... 8.0 ms

Add in something to do in the loop and the loop takes a LOT longer (>2x!), but still doesn't take much time in absolute terms.

The rocks, with 22 textures and the complex lightplay model, cost about the same as the first fish, which has two textures but more polygons. Algorithmically, there isn't much of anything going on with the rocks. They mostly happen on the video card. Also, the rocks, being stationary, are hugely important to selling the illusion since the viewer can examine every wart in detail.

The debris is where an unbelievable amount of time goes. I can't make the same optimization for the debris that I did for the bubbles because the debris are actually in the tank instead of behind it, so we are stuck with the cost until I figure out something else.


(2) In a lush planting tank, the performance varies slightly from 190 fps for an empty tank to 124 fps for a 5-fish tank. The number of fish has a minimal impact on the performace. Therefore can we please allow more fish in the tank?
The number of fish is more a concern of how the fish interact in the collision detection logic than computational considerations. The pond gives you 10 fish, but there is a lot of room for them to move around and nothing for them to hit except each other. Put more fish in a tank with rocks and other objects and they tend to just bounce off each other which isn't very appealing. Eric, ultimately, gets to decide that sort of thing.


(3) The size of the GA application window barely effects the performance until the window size exceeds 1024x768. This is very interesting! Good job!
That is because we don't do anything different based on the size of the window. The hardware takes care of it, and the number of pixels the hardware must deal with is dwarfed by the incoming data (on your machine) unti you get to about that size, then deciding what each pixel should be gets to be a larger issue. I wish I could take credit...


(4) The GA application works very nicely when it spans monitors. When the monitors are connected to different performing video cards, the fps is higher when more of the window overlaps the faster card, and vice versa. When the application overlaps monitors connected to the same card, the performance remains constant. Also good job!
Apple handles all of that in the OpenGL layer and below. We don't do anything special. Again, I wish I could take credit...


(5) It is possible to duplicate the GA application and run them all at the same time on multiple screens if desired. Then you can look at the punishment being visited upon the graphics card using the free utility GET_ATI_NVIDIA_RAM_V059 available from:
For testing purposes we have a build which will create an arbitrary number of windows and put the aquarium in each one. It is useless as a product, but it allows us to stress test the rendering code and simulate people with a whole lot of monitors. It is much more efficient than multiple copies of the application running because the different tanks get to share textures, models and other data.

Looking forward to the next installment!
Jim O'Connor
Order N Development
JimO'Connor is offline   Reply With Quote