[cairo] perf: long dashed lines

Behdad Esfahbod behdad at behdad.org
Sun Feb 3 11:06:19 PST 2008


Thanks Vlad!


+    cairo_matrix_transform_distance (ctm_inverse, &dx0, &dy0);
+    mag = sqrt (dx0 * dx0 + dy0 * dy0);
+    if (mag < 1e-12) {
+       if (mag_out)
+           *mag_out = 0.0;
+       return FALSE;
+    }

mag is in user space, you shouldn't make such size assumptions on it.  I
suggest reworking it a bit such that we have the fixed values there too,
then you can check fixed ints for zero.  Or just check dx0 and dy0
before the transformation.

I'm not sure how slow sqrt is these days, but may be a good idea to
check dx0 and dy0 for being zero and if one is, skip the sqrt
completely.  Check for zero can even be done using memcmp, so I expect
that optimization to work.  Does gcc use memcmp for such a check btw?


Other than these looks good to me.


Cheers,

behdad


On Sat, 2008-02-02 at 19:21 -0500, Vladimir Vukicevic wrote:
> Why yes, yes I did.  I was, um, just testing you guys. Ahem.
> 
> Attached.
> 
>      - Vlad
> 
> 
> On Feb 2, 2008, at 4:04 PM, Bertram Felgenhauer wrote:
> 
> > Hi,
> >
> > You wrote:
> >> Here's one patch that yields a decent speed win... _compute_face was
> >
> > you forgot to attach the patch.
> >
> > regards,
> >
> > Bertram
> 
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759



More information about the cairo mailing list