Skip to content

Instantly share code, notes, and snippets.

@slembcke
Forked from SiarheiFedartsou/gist:7568295
Last active December 28, 2015 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slembcke/7569537 to your computer and use it in GitHub Desktop.
Save slembcke/7569537 to your computer and use it in GitHub Desktop.
const NSUInteger testCount = 1000000;
{
GLKMatrix4 m = M; // Initialized from a global to prevent constant folding when inlining.
CFAbsoluteTime t = CFAbsoluteTimeGetCurrent();
for (NSUInteger i = 0; i < testCount; i++) {
m = GLKMatrix4Multiply(m, m);
}
NSLog(@"time GLKit: %f", CFAbsoluteTimeGetCurrent() - t);
M = m; // Need to save the value of m to avoid it being optimized away
}
{
kmMat4 identity;
kmMat4Identity(&identity);
CFAbsoluteTime t = CFAbsoluteTimeGetCurrent();
for (NSUInteger i = 0; i < testCount; i++) {
kmMat4Multiply(&identity, &identity, &identity);
}
NSLog(@"time kazmath: %f", CFAbsoluteTimeGetCurrent() - t);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment