cairo/perf
2007-02-20 12:54:03 -08:00
..
.gitignore Add new cairo-perf-diff for finding the performance difference between any 2 revisions. 2006-10-25 17:15:22 -07:00
box-outline.c perf: Add box_outline test case. 2006-11-17 18:00:36 -08:00
cairo-perf-cover.c perf: Add linear and radial gradients to the coverage 2006-10-04 17:14:12 -07:00
cairo-perf-diff [perf/cairo-perf-diff] Pass CAIRO_AUTOGEN_OPTIONS to autogen. 2007-01-07 18:12:40 +00:00
cairo-perf-diff-files.c Add --use-ms option to cairo-perf-diff-files 2007-01-19 16:47:31 -08:00
cairo-perf-posix.c perf: Rename finalize to synchronize as it is used in both start() and stop() now 2006-10-05 15:14:14 -07:00
cairo-perf-win32.c perf: Rename finalize to synchronize as it is used in both start() and stop() now 2006-10-05 15:14:14 -07:00
cairo-perf.c [quartz] rename NQUARTZ -> QUARTZ in defines 2007-02-20 12:54:03 -08:00
cairo-perf.h Add "rectangles" perf test 2007-01-31 11:53:06 -08:00
cairo-stats.c perf: Eliminate CAIRO_STATS_MIN_VALID_SAMPLES 2006-11-08 06:07:01 -08:00
cairo-stats.h perf: Eliminate CAIRO_STATS_MIN_VALID_SAMPLES 2006-11-08 06:07:01 -08:00
fill.c perf: Add stroke and fill tests 2006-10-04 17:14:12 -07:00
long-lines.c Add long-lines perf case 2007-01-05 16:50:11 -08:00
Makefile.am Add "rectangles" perf test 2007-01-31 11:53:06 -08:00
Makefile.win32 [perf] Change perf output format, report times in ms, add a few paint tests 2006-09-19 12:19:20 -07:00
mosaic.c New performance test case "mosaic" for splines. 2006-12-16 21:32:19 +02:00
mosaic.h New performance test case "mosaic" for splines. 2006-12-16 21:32:19 +02:00
paint.c perf: Move iteration over sources and operators from paint to new cairo-perf-cover 2006-10-04 17:14:12 -07:00
pattern_create_radial.c Add new perf test "pattern_create_radial" 2006-11-02 10:38:00 -08:00
README perf: Make cairo_t* available to perf functions 2006-10-04 17:14:11 -07:00
rectangles.c Add "rectangles" perf test 2007-01-31 11:53:06 -08:00
stroke.c perf: Add stroke and fill tests 2006-10-04 17:14:12 -07:00
subimage_copy.c perf: Add subimage_copy test to demonstrate performance bug found by monty 2006-10-05 12:31:50 -07:00
tessellate.c perf: Make cairo_t* available to perf functions 2006-10-04 17:14:11 -07:00
text.c perf: Add text test 2006-10-05 12:31:50 -07:00
unaligned-clip.c Add unaligned_clip perf case courtesy of Jeff Muizelaar 2007-01-09 14:31:22 -08:00
world-map.c perf: Add world-map performance test case. 2006-11-08 06:07:01 -08:00
world-map.h perf: Add world-map performance test case. 2006-11-08 06:07:01 -08:00
zrusin-another.h Add zrusin-another test cases (tessellate and fill). 2006-11-06 23:56:19 -08:00
zrusin.c Add zrusin-another test cases (tessellate and fill). 2006-11-06 23:56:19 -08:00

This is cairo's performance test suite.

To run the performance tests simply type:

	make perf

and the tests results will be printed on stdout

TODO: We'll want to add support for charting the results. Various
charts would be interesting:

  * For a given test, how does its performance scale as a function of
    image size

  * For a given test, how do the various backends perform

  * For a given test, how has the performance changed throughout the
    history of cairo development.

TODO: We'll also want to make it easy to run individual tests for
profiling, etc.

Creating a new performance test
-------------------------------
This is where we could use everybody's help. If you have encountered a
sequence of cairo operations that are slower than you would like, then
please provide a performance test. Writing a test is very simple, it
requires you to write only a small C file with a couple of functions,
one of which exercises the cairo calls of interest.

Here is the basic structure of a performance test file:

    /* Copyright © 2006 Kind Cairo User
     *
     * ... Licensing information here ...
     * Please copy the MIT blurb as in other tests
     */

    #include "cairo-perf.h"

    static cairo_perf_ticks_t
    do_my_new_test (cairo_t *cr, int width, int height)
    {
	cairo_perf_timer_start ();

	/* Make the cairo calls to be measured */

	cairo_perf_timer_stop ();

	return cairo_perf_timer_elapsed ();
    }

    void
    my_new_test (cairo_perf_t *perf, cairo_t *cr, int width, int height)
    {
	/* First do any setup for which the execution time should not
	 * be measured. For example, this might include loading
	 * images from disk, creating patterns, etc. */

	/* Then launch the actual performance testing. */
	cairo_perf_run (perf, "my_new_test", do_my_new_test);

	/* Finally, perform any cleanup from the setup above. */
    }

That's really all there is to writing a new test. The first function
above is the one that does the real work and returns a timing
number. The second function is the one that will be called by the
performance test rig (see below for how to accomplish that), and
allows for multiple performance cases to be written in one file,
(simply call cairo_perf_run once for each case, passing the
appropriate callback function to each).

We go through this dance of indirectly calling your own function
through cairo_perf_run so that cairo_perf_run can call your function
many times and measure statistical properties over the many runs.

Finally, to fully integrate your new test case you just need to add
your new test to three different lists. (TODO: We should set this up
better so that the lists are maintained automatically---computed from
the list of files in cairo/perf, for example). Here's what needs to be
added:

 1. Makefile.am: Add the new file name to the cairo_perf_SOURCES list

 2. cairo-perf.h: Add a new CAIRO_PERF_DECL line with the name of your
    function, (my_new_test in the example above)

 3. cairo-perf.c: Add a new row to the list at the end of the file. A
    typical entry would look like:

	{ my_new_test, 16, 64 }

    The last two numbers are a minimum and a maximum image size at
    which your test should be exercised. If these values are the same,
    then only that size will be used. If they are different, then
    intermediate sizes will be used by doubling. So in the example
    above, three tests would be performed at sizes of 16x16, 32x32 and
    64x64.

Thanks for your contributions and have fun with cairo!