[cairo] Patches for speeding up _cairo_fixed_from_double

Carl Worth cworth at cworth.org
Mon Nov 6 10:35:51 PST 2006


On Wed, 1 Nov 2006 22:53:33 -0800, "Daniel Amelang" wrote:
> Attached are patches resulting from the discussion here:
>
> http://lists.freedesktop.org/archives/cairo/2006-October/008285.html

Daniel,

Thank you so much for such an excellent patch submission! They really
don't get much better than this. So, everyone, please feel free to
imitate Daniel's style here, for example:

 * Submission references past discussion with link

 * New code includes comments for the black magic parts

 * Submission includes performance test case as separate patch

 * Submission has logically separate pieces as separate patches

 * Submission includes results of cairo-perf-diff showing improvement

Very well done, thank you.

This stuff is all pushed out now. I would have done that sooner, but I
was using this patch to do some tweaking of the cairo-perf-diff code,
(I've got some more tweaking to do, but I'll just continue to use this
code in the history instead). So, sorry for the bit of delay there.

> API calls where conversion takes place. I don't really recommend that
> this make it into the main performance suite, as it's pretty specific
> to this particular case, but I'm including it here for posterity.

I disagree with your hesitance against including the test. One of the
primary reasons I was motivated to implement the performance test
suite was so that we could avoid performance regressions after people
submitted performance improvements. And it doesn't help us do that
unless we add the test cases.

In the comments for the test case you did apologize a bit for the code
doing something not very realistic, (creating and destroying 100000
radial patterns and never using them). Doing strange things in the
test cases is perfectly fine as long as it's for the purpose of
stressing something that has been shown to be a problem in real-world
cases, (in this instance, the floating-point conversion code).

I did drop the iterations down to 10000 just to make the test case run
a bit faster.

> Both the autoconf macro and _cairo_fixed_from_double code are perhaps
> overly documented, but they both use pretty unusual techniques, so I
> figured they could use the extra attention.

A very good call. There's some mystic stuff there, and I'm glad to see
such detailed comments. It might be more ego-satisfying to write,
"You're not supposed to understand this", but I'm much happier if
readers of cairo code find it educational. So thank you.

> Anyone with one willing to test?

I will be doing that this week. I'm going to be putting together a
development snapshot with all the performance work that's been
happening since the 1.2 branch, and I want to publish that with the
results of:

	cairo-perf-diff 1.2.6 master

on both an x86 laptop and a Nokia 770.

So far, we've already got the following in place:

 * Monty's major bug fix when copying small pieces of xlib surfaces
   (subimage_copy)

 * Daniel's fast floating-point conversion code
   (pattern_create_radial)

Other stuff I'll be landing before the snapshot includes:

 * David Turner's gradient fixes

 * A new rasterization idea I've got, (a single table lookup per pixel
   rather than 15 Bresenham steps that we are currently doing).

Anyway, thanks again,

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20061106/7b6e15d0/attachment.pgp


More information about the cairo mailing list