cairo/perf
Vladimir Vukicevic 8a9b99e596 [perf] Change perf output format, report times in ms, add a few paint tests
This changes the perf test output format to be a little more human friendly,
reporting times in ms instead of seconds.  It also adds a test number
that could be used in the future for specifying an explicit test to run
(test number, target surface, test name, and size uniquiely identify
a test).

Also adds a few paint tests.
2006-09-19 12:19:20 -07:00
..
.gitignore Update 2006-09-06 13:49:02 -04:00
cairo-perf-posix.c perf: Make xlib testing wait for the X server to finish rendering. 2006-09-11 10:59:38 -07:00
cairo-perf-win32.c [win32,perf] Fix cairo-perf-win32 2006-09-19 12:19:20 -07:00
cairo-perf.c [perf] Change perf output format, report times in ms, add a few paint tests 2006-09-19 12:19:20 -07:00
cairo-perf.h [perf] Change perf output format, report times in ms, add a few paint tests 2006-09-19 12:19:20 -07:00
Makefile.am [perf/Makefile] Unset DIST_SUBDIRS 2006-09-06 13:49:27 -04: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
paint.c [perf] Change perf output format, report times in ms, add a few paint tests 2006-09-19 12:19:20 -07:00
README perf/README: Update due to cairo_perf_timer API changes 2006-09-06 00:56:56 -07:00
tessellate.c perf: Add tessellate test case (in -16, -64, and -256 varieties) 2006-09-06 05:17:01 -07: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 single function exercising 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"

     cairo_perf_ticks_t
     my_new_test (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. */

         cairo_perf_timer_start ();

	 /* Now make the real cairo calls to be measured */

	 cairo_perf_timer_stop ();

	 /* Finally, any cleanup */

	 /* Then return the time that elapsed. */

	 return cairo_perf_timer_elapsed ();
     }

That's really all there is to writing a new test. Then, to fully
integrate this 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

 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", 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!