[cairo] Patch: speeding up _cairo_fixed_from_double

David Reveman davidr at novell.com
Wed Oct 5 14:20:32 PDT 2005


On Wed, 2005-10-05 at 12:17 -0700, Carl Worth wrote:
> On Wed, 05 Oct 2005 11:50:51 -0700, Bill Spitzak wrote:
> > I also posted the same thing some time ago, not sure what happened to 
> > that as I never got any response.
> 
> Would you believe it's still in my inbox? (It is, along with several
> hundred other things that I really do intend to look at
> eventually).
> 
> NOTE: If other people are frustrated by similarly "lost" messages,
> please feel free to reply to the original message, or open up new
> bugs against cairo at http://bugs.freedesktop.org. It's your choice
> which forum to use.
> 
> What held me up before on doing anything with this was honestly that I
> just didn't understand the code.
> 
> > Tim Rowley wrote:
> > > Doing some profiling runs with gradients, I noticed that a lot of the 
> > > time was disappearing into _cairo_fixed_from_double (and its 
> > > descendents, ftol and floor).  Searching around I found this page that 
> > > talks about doing fast floating point to integer conversion:
> > > 
> > >     http://www.stereopsis.com/FPU.html
> > > 
> > > Adapting one of the methods for cairo gave about a 25% speed increase in 
> > > our gradient tests.
> 
> Thanks for the reference. And it's encouraging to get two reports of
> significant speedup from this technique.
> 
> I'll be looking into this a bit more closely now, (even if only for my
> own education).
> 
> Meanwhile, while I think this patch will be landing soon, I think the
> big hit from _cairo_fixed_from_double in radial gradients is evidence
> that the radial gradient code is still largely inefficient in even
> bigger ways, which I also want to spend some time looking into today.


I'd like to use the gradient code in libpixman/xserver instead. I think
that that code is already a lot faster than the gradient code in cairo
as it's using color spans but I think it's also using color spans when
it shouldn't which we'll have to fix. 

We should throw away my old gradient code in cairo. I never tried to
make it really fast but for not containing any code for special cases
that are easy to optimize, it's not that bad.


-David



More information about the cairo mailing list