cairo/perf
2009-01-02 09:53:20 +00:00
..
.gitignore [perf] A crude tool to visualise performance changes across a series. 2008-10-19 09:36:53 +01:00
box-outline.c perf: Add box_outline test case. 2006-11-17 18:00:36 -08:00
cairo-perf-cover.c [perf] add tests for magnified and minified image sources. 2008-02-19 22:19:44 +01:00
cairo-perf-diff [perf-diff] Fix cairo-perf-diff for git 1.6 2008-12-06 13:32:37 +02:00
cairo-perf-diff-files.c [perf] A crude tool to visualise performance changes across a series. 2008-10-19 09:36:53 +01:00
cairo-perf-graph [perf] Fix for git-1.6 2008-12-14 16:41:17 +00:00
cairo-perf-graph-files.c [perf] Fix errors reported by cppcheck 2009-01-02 09:53:20 +00:00
cairo-perf-graph-widget.c [perf] A crude tool to visualise performance changes across a series. 2008-10-19 09:36:53 +01:00
cairo-perf-graph.h [perf] A crude tool to visualise performance changes across a series. 2008-10-19 09:36:53 +01:00
cairo-perf-os2.c [perf] Add OS/2 implementation for timer routines 2007-04-22 07:11:00 -04:00
cairo-perf-posix.c [perf-suite] Explicitly read the results of rdtsc from edx:eax. 2008-09-25 00:17:57 +03:00
cairo-perf-report.c [perf] Fix errors reported by cppcheck 2009-01-02 09:53:20 +00: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 [perf] Add perf tests to hit rectilinear code paths. 2008-12-06 13:30:29 +02:00
cairo-perf.h [perf] Add perf tests to hit rectilinear code paths. 2008-12-06 13:30:29 +02:00
cairo-stats.c Fix typo in loop control for computation of std. deviation 2007-04-12 18:16:52 -07:00
cairo-stats.h [perf] A crude tool to visualise performance changes across a series. 2008-10-19 09:36:53 +01:00
composite-checker.c [perf] Free images for composite-checker 2008-10-20 23:04:03 +01:00
COPYING Add a COPYING file to each aux. source directory 2008-10-31 16:14:14 +00:00
dragon.c [perf/dragon] Add a dragon curve perf case. 2008-11-19 14:06:10 +00:00
fill.c perf: Add stroke and fill tests 2006-10-04 17:14:12 -07:00
intersections.c [perf] Explicitly test rendering a path with lots of intersections. 2008-12-06 13:21:44 +02:00
long-dashed-lines.c [perf] Add pixman_region_init_rects and use in extract_region 2007-06-18 14:02:41 -07:00
long-lines.c Add long-lines perf case 2007-01-05 16:50:11 -08:00
make-html.py Transform the output of cairo-perf-diff into HTML 2007-03-14 21:41:40 +01:00
Makefile.am [perf] Add perf tests to hit rectilinear code paths. 2008-12-06 13:30:29 +02:00
Makefile.win32 [perf] A crude tool to visualise performance changes across a series. 2008-10-19 09:36:53 +01: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-with-alpha.c perf: Add new paint-with-alpha test 2007-04-25 07:24:23 -07: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
pythagoras-tree.c [perf/pythagoras_tree] Another fractal. 2008-11-19 14:06:10 +00:00
README [win32] Make cairo-perf-diff run on win32 2008-07-17 13:56:22 -07:00
rectangles.c [perf] Add rounded rectangle perf case. 2008-09-28 18:59:43 +01:00
rounded-rectangles.c [perf] Add rounded rectangle perf case. 2008-09-28 18:59:43 +01:00
spiral.c [perf] Add perf tests to hit rectilinear code paths. 2008-12-06 13:30:29 +02: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 Check for error whilst trying to advance along a text string. 2007-04-09 16:13:16 -07:00
twin.c [perf] Correct another reference to '<cairo>' 2009-01-02 09:53:20 +00:00
unaligned-clip.c [perf] Fix rectangular case of unaligned-clip. 2008-10-28 09:06:25 +00:00
world-map.c Some fixes and improvements to the Win32 build 2008-02-06 21:45:24 -05: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.

One of the simplest ways to run the performance suite is:

    make perf

which will give a report of the speed of each individual test. See
more details on other options for running the suite below.

Running the cairo performance suite
-----------------------------------
The lowest-level means of running the test suite is with the
cairo-perf program, (which is what "make perf" executes). Some
examples of running it:

    # Report on all tests with default number of iterations:
    ./cairo-perf

    # Report on 100 iterations of all gradient tests:
    ./cairo-perf -i 100 gradient

    # Generate raw results for 10 iterations into cairo.perf
    ./cairo-perf -r -i 10 > cairo.perf
    # Append 10 more iterations of the paint test
    ./cairo-perf -r -i 10 paint >> cairo.perf

Raw results aren't useful for reading directly, but are quite useful
when using cairo-perf-diff to compare separate runs (see more
below). The advantage of using the raw mode is that test runs can be
generated incrementally and appended to existing reports.

Generating comparisons of separate runs
---------------------------------------
It's often useful to generate a chart showing the comparison of two
separate runs of the cairo performance suite, (for example, after
applying a patch intended to improve cairo's performance). The
cairo-perf-diff script can be used to compare two report files
generated by cairo-perf.

Again, by way of example:

    # Show performance changes from cairo-orig.perf to cairo-patched.perf
    ./cairo-perf-diff cairo-orig.perf cairo-patched.perf

This will work whether the data files were generate in raw mode (with
cairo-perf -r) or cooked, (cairo-perf without -r).

Finally, in its most powerful mode, cairo-perf-diff accepts two git
revisions and will do all the work of checking each revision out,
building it, running cairo-perf for each revision, and finally
generating the report. Obviously, this mode only works if you are
using cairo within a git repository, (and not from a tar file). Using
this mode is as simple as passing the git revisions to be compared to
cairo-perf-diff:

    # Compare cairo 1.2.6 to cairo 1.4.0
    ./cairo-perf-diff 1.2.6 1.4.0

    # Measure the impact of the latest commit
    ./cairo-perf-diff HEAD~1 HEAD

As a convenience, this common desire to measure a single commit is
supported by passing a single revision to cairo-perf-diff, in which
case it will compare it to the immediately preceeding commit. So for
example:

    # Measure the impact of the latest commit
    ./cairo-perf-diff HEAD

    # Measure the impact of an arbitrary commit by SHA-1
    ./cairo-perf-diff aa883123d2af90

Also, when passing git revisions to cairo-perf-diff like this, it will
automatically cache results and re-use them rather than re-running
cairo-perf over and over on the same versions. This means that if you
ask for a report that you've generated in the past, cairo-perf-diff
should return it immediately.

Now, sometimes it is desirable to generate more iterations rather than
re-using cached results. In this case, the -f flag can be used to
force cairo-perf-diff to generate additional results in addition to
what has been cached:

    # Measure the impact of latest commit (force more measurement)
    ./cairo-perf-diff -f

And finally, the -f mode is most useful in conjunction with the --
option to cairo-perf-diff which allows you to pass options to the
underlying cairo-perf runs. This allows you to restrict the additonal
test runs to a limited subset of the tests.

For example, a frequently used trick is to first generate a chart with
a very small number of iterations for all tests:

    ./cairo-perf-diff HEAD

Then, if any of the results look suspicious, (say there's a slowdown
reported in the text tests, but you think the text test shouldn't be
affected), then you can force more iterations to be tested for only
those tests:

    ./cairo-perf-diff -f HEAD -- text

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.

How to run cairo-perf-diff on WINDOWS
-------------------------------------
This section explains the specifics of running cairo-perf-diff under
win32 plateforms. It assumes that you have installed a UNIX-like shell
environment such as MSYS (distributed as part of MinGW).

 1. From your Mingw32 window, be sure to have all of your MSVC environ-
    ment variables set up for proper compilation using 'make'

 2. Add the %GitBaseDir%/Git/bin path to your environment, replacing the 
    %GitBaseDir% by whatever directory your Git version is installed to.

 3. Comment out the "UNSET CDPATH" line in the git-sh-setup script 
    (located inside the ...Git/bin directory) by putting a "#" at the 
    beginning of the line.

you should be ready to go !

From your mingw32 window, go to your cairo/perf directory and run the 
cairo-perf-diff script with the right arguments.

Thanks for your contributions and have fun with cairo!