Categories
Featured iPhone Development Resources

iPhone Math Library – Open Source 400%+ Faster

If you’re app makes extensive use of trigonometry (and if you’re working on game development then you probably are) then you probably make extensive use of the built in math functions.  This isn’t the first open source iPhone math library to offer a speed increase, but it is the only one as far as I know that is still in active development.

According to Apple  apps that make extensive use of floating point numbers should not make use of the thumb compiling option which reduces code size.

Dave Dribin has created a math library exclusively making use of integers, and based on the speed of the sine function vs. the standard libary sin and sinf functions it looks like Dave’s trigint library is at least 4x faster.

You can find the library and more info here:
Trigint: An Integer-Based Trigonmetry Library

Thanks for reading, please share this using the buttons below!

[via: Under The Bridge]

3 replies on “iPhone Math Library – Open Source 400%+ Faster”

The only advantage to using THUMB is lower memory usage and smaller binary size. Binary size isn’t an issue on the iPhone and it doesn’t seem reasonable to sacrifice 32-bit performance to shave a few kilobytes of memory usage. And using a third party library emulating floating point math will use up extra memory. Unless I am mistaken….

Actually there is a small speed advantage too, but it has been reduced with each edition of the iPhone (I believe the estimate was about 10% now). That wasn’t really the point of it, I was just summarizing what is on the libraries download page.. The author has created several 1,000 word posts you can go through on the details of compiling and the ARM compiler.. if you’ve got the time to read them.. all yours 🙂

The point was that the math library is multiples faster than the regular math functions.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.