A: 

Could it be that you're not closing your path? Right at the end you might need:

CGContextClosePath(context);

No one in particular
I actually missed one line while copy pasting. But i have CGContextSetStrokePath(context) right after the last line of code within the function.Does CGContextSetStrokePath close the path as well? Or does that have be added as well?
Swapan Rajdev
Where did you get CGContextSetStrokePath() from? I can't find that in the developer documentation.
No one in particular
Sorry that was a typo: CGContextStrokePath() is what i have.
Swapan Rajdev
A: 

Have you profiled your app to figure out where most of the time is spent when it slows down?

It could be in the path stroke in core graphics, in your computational methods, or somewhere else. If you start optimizing before you have any profile/performance data, you may end up spending time in the wrong place.

hotpaw2
Thanks for the suggestion. I have not profiled my app. Is instruments the best tool to gather such data?
Swapan Rajdev