Post-1.6.0 performance
Posted: 04.09.2009, 01:01
Several people have expressed concerns about the performance of the current SVN version of Celestia. The SVN code isn't near a release state--there's lots of feature and optimization work left to be done. Don't despair if your freshly compiled SVN version of Celestia seems to be running slower than it should. There's probably a simple reason for it that will be addressed well before the release of the next major version. Here are a few cel URLs you can use to try and track down the source of any slowdown (or speedup ):
1. Earth view at startup, no DSOs:
cel://Follow/Sol:Earth/2009-09-04T00:37 ... rc=0&ver=3
2. Antarctica zoom:
cel://Follow/Sol:Earth/2009-09-04T00:39 ... rc=0&ver=3
3. Just stars:
cel://Follow/Sol:Earth/2009-09-04T00:41 ... rc=0&ver=3
4. Stars + DSOs:
cel://Follow/Sol:Earth/2009-09-04T00:42 ... rc=0&ver=3
5. Orbits:
cel://Follow/Sol/2009-09-04T00:44:46.59 ... rc=0&ver=3
To benchmark, do the following:
- Disable sync to vertical refresh in you graphics card control panel
- Start Celestia with just the basic package content (i.e. no add-ons)
- Turn on the frames per second display by pressing ` (backquote).
- The frame rate will fluctuate somewhat; I'm in the habit of reporting the peak frame rate
For this benchmark, it's best to run without anti-aliasing to see more dramatic performance differences.
There are four changes since 1.6.0 that are most likely to affect performance: the switch to Eigen, enabling anisotropic filtering, enabling vertex buffer objects (VBOs), and the new orbit drawing code. Here are the changes most likely to affect the performance for the five cel URLs listed:
1. VBOs, Anisotropic filtering
2. Anisotropic filtering, VBOs (aniso will have more of an impact for this URL than for #1)
3. Eigen
4. Eigen
5. New orbit code, Eigen
So, if you see a slowdown when viewing URLs 1 and 2, it would suggest that either VBOs or anisotropic filtering is responsible. Etc...
For those interested, here are some more details on each of the four performance affecting changes:
Conversion to Eigen
In version 1.6.0, Celestia used a custom set of classes for arithmetic on vectors, matrices, and quaternions. These are replaced in the SVN version by the classes from the Eigen linear algebra library. The switch to Eigen was a very intrusive change--almost every Celestia source file had to be changed. The motivations for switching were code clarity and performance (see this thread for details: viewtopic.php?f=10&t=14025.) Eigen is optimized to use a CPU's vector instruction set--SSE2 on Intel, AltiVec on PowerPC. Some things may actually run a bit slower without SSE2/Altivec enabled. There were a few places in the Celestia code where I've optimized code for vectorization at the expense of lower performance without vectorization. In some cases, compiler settings to enable vectorization haven't been enabled in the project files in SVN (yet): the XCode project for Mac, and Qt4 project for Mac and Windows will probably--it depends on the OS version an compiler install--build Celestia without vectorization, resulting in reduced performance. We're working on it... When vectorization is enabled and all compiler flags are set properly, Celestia should run faster than before.
Anisotropic filtering
Anisotropic texture filtering was enable by default in Celestia after 1.6.0. Turning it on greatly improves the appearance of planet texture near the poles, but it does come at some cost in performance. Exactly how much depends on the graphics card--in some cases the performance drop is hardly noticeable, while in other situations it can reduce the frame rate by 25% or more. The choice between quality and speed should be up to the user, and the plan is to provide 'Render Quality' GUI that will give the user control over anisotropic filtering and other settings.
Vertex buffers objects
Vertex buffer objects (VBOs) are a relatively new OpenGL feature that allow 3D applications to use graphics hardware more efficiently. After 1.6.0, I turned on a switch to use VBOs for planet rendering. Several people on the developers list tried out the change, and the results ranged from a very small speed increase to over 30% gains with newer hardware. It's possible that older graphics cards and/or drivers don't support VBOs well, and might actually run slower with VBOs on. Something to watch out for, but so far, we haven't seen this happen.
New trajectory rendering
The code to draw orbit paths has been completely rewritten (and is still being updated.) The new code draws orbits much more accurately, and in a lot of cases it's also faster (around 100% faster when drawing the orbit of Cassini.) We're still looking at the performance of the new orbit code. It's possible that it will be slower for some objects and/or viewpoints. The new orbit code will only affect performance when orbit paths are visible; when they're disable, the new orbit code isn't used at all.
--Chris
1. Earth view at startup, no DSOs:
cel://Follow/Sol:Earth/2009-09-04T00:37 ... rc=0&ver=3
2. Antarctica zoom:
cel://Follow/Sol:Earth/2009-09-04T00:39 ... rc=0&ver=3
3. Just stars:
cel://Follow/Sol:Earth/2009-09-04T00:41 ... rc=0&ver=3
4. Stars + DSOs:
cel://Follow/Sol:Earth/2009-09-04T00:42 ... rc=0&ver=3
5. Orbits:
cel://Follow/Sol/2009-09-04T00:44:46.59 ... rc=0&ver=3
To benchmark, do the following:
- Disable sync to vertical refresh in you graphics card control panel
- Start Celestia with just the basic package content (i.e. no add-ons)
- Turn on the frames per second display by pressing ` (backquote).
- The frame rate will fluctuate somewhat; I'm in the habit of reporting the peak frame rate
For this benchmark, it's best to run without anti-aliasing to see more dramatic performance differences.
There are four changes since 1.6.0 that are most likely to affect performance: the switch to Eigen, enabling anisotropic filtering, enabling vertex buffer objects (VBOs), and the new orbit drawing code. Here are the changes most likely to affect the performance for the five cel URLs listed:
1. VBOs, Anisotropic filtering
2. Anisotropic filtering, VBOs (aniso will have more of an impact for this URL than for #1)
3. Eigen
4. Eigen
5. New orbit code, Eigen
So, if you see a slowdown when viewing URLs 1 and 2, it would suggest that either VBOs or anisotropic filtering is responsible. Etc...
For those interested, here are some more details on each of the four performance affecting changes:
Conversion to Eigen
In version 1.6.0, Celestia used a custom set of classes for arithmetic on vectors, matrices, and quaternions. These are replaced in the SVN version by the classes from the Eigen linear algebra library. The switch to Eigen was a very intrusive change--almost every Celestia source file had to be changed. The motivations for switching were code clarity and performance (see this thread for details: viewtopic.php?f=10&t=14025.) Eigen is optimized to use a CPU's vector instruction set--SSE2 on Intel, AltiVec on PowerPC. Some things may actually run a bit slower without SSE2/Altivec enabled. There were a few places in the Celestia code where I've optimized code for vectorization at the expense of lower performance without vectorization. In some cases, compiler settings to enable vectorization haven't been enabled in the project files in SVN (yet): the XCode project for Mac, and Qt4 project for Mac and Windows will probably--it depends on the OS version an compiler install--build Celestia without vectorization, resulting in reduced performance. We're working on it... When vectorization is enabled and all compiler flags are set properly, Celestia should run faster than before.
Anisotropic filtering
Anisotropic texture filtering was enable by default in Celestia after 1.6.0. Turning it on greatly improves the appearance of planet texture near the poles, but it does come at some cost in performance. Exactly how much depends on the graphics card--in some cases the performance drop is hardly noticeable, while in other situations it can reduce the frame rate by 25% or more. The choice between quality and speed should be up to the user, and the plan is to provide 'Render Quality' GUI that will give the user control over anisotropic filtering and other settings.
Vertex buffers objects
Vertex buffer objects (VBOs) are a relatively new OpenGL feature that allow 3D applications to use graphics hardware more efficiently. After 1.6.0, I turned on a switch to use VBOs for planet rendering. Several people on the developers list tried out the change, and the results ranged from a very small speed increase to over 30% gains with newer hardware. It's possible that older graphics cards and/or drivers don't support VBOs well, and might actually run slower with VBOs on. Something to watch out for, but so far, we haven't seen this happen.
New trajectory rendering
The code to draw orbit paths has been completely rewritten (and is still being updated.) The new code draws orbits much more accurately, and in a lot of cases it's also faster (around 100% faster when drawing the orbit of Cassini.) We're still looking at the performance of the new orbit code. It's possible that it will be slower for some objects and/or viewpoints. The new orbit code will only affect performance when orbit paths are visible; when they're disable, the new orbit code isn't used at all.
--Chris