Using sincos (was Re: [cairo] Questions and optimizations in cairo-arc)

Behdad Esfahbod behdad at cs.toronto.edu
Tue Aug 23 08:45:57 PDT 2005


On Mon, 22 Aug 2005, David Schleef wrote:

> I'm going to toss out a suggestion: don't use sincos().  The sincos()
> function is an uninteresting optimization that is merely causing
> developers to spend time on getting it right.  Yes, it's slightly
> faster.  No, it is not used in any place where it makes a difference.
> And no, it's not nearly as fast as inlining an fsincos instruction.
> (Which, btw, gcc-4.0 does automatically if you let it.)  And if it
> ever does matter, liboil has an array-based function that actually
> makes sin/cos calculations fast.

I actually like it form a coding-style point of view, not
optimization.  If I'm asking for sin() and cos() of the same
angle, I find it more readable to do that by passing the angle
only once.  YMMV. :)


> dave...

--behdad
http://behdad.org/


More information about the cairo mailing list