Tuesday, September 15, 2009

Row major vs column major performance

I wrote my own 4x4 matrix class at the start of CS513 and stored it in column major order since this is how OpenGL expects matrices. However, Cg expects them in row-major order. So before I can pass a matrix to Cg, I have to transpose. Expecting this to be a performance hit, I set up my matrix class and demo app to take a -DCOLUMN_MAJOR at compile time so that I could compare performance.

No performance change. Well, it looks like column major may give me 110 frames per second and row major gives me 109 frames per second.

I've also added a frames per second counter to my app and display it in the upper right side of the window so that I can see when frame rate changes.

No comments:

Post a Comment