[cairo] Tessellator performance patch
Rafael Villar Burke
pachi at rvburke.com
Mon Dec 4 05:06:00 PST 2006
M Joonas Pihlaja escribió:
>
> Hi Rafael,
>
> On Mon, 4 Dec 2006, Rafael Villar Burke wrote:
>
>> Subject: [PATCH] Additional fast path tests to avoid intersection
>> computation
> [snip]
>> + cairo_bo_point32_t a = edge1->top;
>> + cairo_bo_point32_t b = edge1->bottom;
>> + cairo_bo_point32_t c = edge2->top;
>> + cairo_bo_point32_t d = edge2->bottom;
>> +
>> + int crossp_abc = (b.x - a.x)*(c.y - a.y) - (c.x - a.x)*(b.y - a.y);
>> + int crossp_abd = (b.x - a.x)*(d.y - a.y) - (d.x - a.x)*(b.y - a.y);
>> + int crossp_cda = (d.x - c.x)*(a.y - c.y) - (a.x - c.x)*(d.y - c.y);
>> + int crossp_cdb = (d.x - c.x)*(b.y - c.y) - (b.x - c.x)*(d.y - c.y);
>
> These multiplications are liable to overflow 32 bits and throw off the
> later sign checks. Could you replace them with a 64 bit version and
> rerun your tests?
I've just tried using int32x32_64 operations to do the cross products
and it shows a ~x1.10-1.20 speed difference with respect to origin. When
using det32_64 to do the math the speed gain is a bit lower, so I'm
trying now other strategies to avoid those functions.
Regards,
Rafael Villar Burke
More information about the cairo
mailing list