Commit graph

338 commits

Author SHA1 Message Date
Andrea Canciani
374b26ff03 perf: Add hash table benchmark
A benchmark to test the speed of hash tables when inserting and
removing a huge number of elements.

Although originally hash tables were assumed not to get many
deletions, in practice they are now being used as caches in multiple
places. This means that they often have a fixed number of live
elements and an element is evicted whenever a new element is inserted
(this happens explicitly for cairo_cache_t objects, but also, for
example, in scaled_font_map + holdovers). This access pattern is very
inefficient with the current implementation.
2011-08-03 12:31:41 +02:00
Chris Wilson
c5405f7324 perf: Save/restore gstate across runs
Reset the cairo_t to the initial state so that subsequent tests are not
affected by earlier tests.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-01 12:59:06 +01:00
Chris Wilson
fec80f1199 perf: Add a few more variations to dragon to exercise unaligned lines/spans
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-01 12:08:55 +01:00
Andrea Canciani
e04e368748 Remove useless checks for NULL before freeing
This patch has been generated by the following Coccinelle semantic patch:
// Remove useless checks for NULL before freeing
//
// free (NULL) is a no-op, so there is no need to avoid it

@@
expression E;
@@
+ free (E);
+ E = NULL;
- if (unlikely (E != NULL)) {
-   free(E);
(
-   E = NULL;
|
-   E = 0;
)
   ...
- }

@@
expression E;
@@
+ free (E);
- if (unlikely (E != NULL)) {
-   free (E);
- }
2011-07-31 16:46:36 +02:00
Andrea Canciani
e8e765605c Silence gcc warnings 2011-07-29 10:51:19 +02:00
Chris Wilson
9ab9ecfdbd test,perf: Another hatching!
This one illustrates the quadratic explosion lurking in the clipping
code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-19 00:32:45 +01:00
Chris Wilson
3a29365713 tests,perf: Add a hatchings clip-test
A benchmark to test how close we get to reducing paint+clip to an ordinary
fill, and to check correctness.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-18 10:31:25 +01:00
Nis Martensen
1a4e9f1e91 Fix typos
Reported in
http://lists.cairographics.org/archives/cairo/2011-May/021921.html
2011-06-25 10:19:23 +02:00
Andrea Canciani
463a8b67a3 perf: Fix build on win32
The performance tools build system for Win32 hasn't been maintained
for some time.  The makefiles are now structured as in other
directories (Makefile.sources used by both Makefile.am and
Makefile.win32) and some additional code hides os-specific parts.
2011-06-24 14:13:09 +02:00
Andrea Canciani
33403cfb37 perf: Ensure M_SQRT2 is defined
pythagoras-tree uses M_SQRT2, which on Win32 is defined by math.h if
and only if _USE_MATH_DEFINES is defined.
2011-06-24 14:13:09 +02:00
Andrea Canciani
f21ac5b13b error: Do not define _cairo_error twice
cairo-perf-trace uses cairo-hash.c, which calls _cairo_error.

Instead of redefining it in cairo-perf-trace.c it can be abstracted in
a separate source which is directly included in the build of
cairo-perf-trace.

This avoids visibility issues when compiling cairo-perf-trace with a
statically linked cairo library on architectures which do not support
hidden visibility (example: win32).
2011-06-24 11:57:22 +02:00
Chris Wilson
27d26bb8b5 cairo-perf-diff-files: Don't print size/content for trace results
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-06 15:09:50 +01:00
Chris Wilson
bf1b08d066 perf 2011-06-02 08:57:13 +01:00
Chris Wilson
52f79bfcf3 perf/micro: Add wave
Benjamin just demonstrated this funky trick for generating pixel
outlines, and as no good deed should go unpunished, I've added his code
to the perf suite.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-01 19:17:06 +01:00
Chris Wilson
c6c3bdba4b perf: Only print description once per backend
Currently we print the backend description before every time, which is
overly verbose. As the information doesn't^Wshouldn't change, simply
print it before running the first test of each target.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-10-20 14:26:37 +01:00
David Schleef
73470862cb perf: Fix README to say cairo-perf-micro 2010-08-10 02:37:38 +02:00
Andrea Canciani
7668323649 perf: Improve calibration
Make the loops count depend on the actual calibration_loops/calibration_time
instead of calibration_loops/calibration_max_time.
This avoids having some tests take much less/more than the wanted time per iteration
(I was having some tests taking about 1 second, other taking about 7 seconds when
the ms_per_iteration was 2000)

Spend 0.5-1 times the time wanted for each iteration in calibration, increase the
accuracy of loops count. Just making the loops count be the correct ratio doesn't
guarantee that the iteration time is accurate. By actually measuring iteration
times until it gets greater than 1/4 of the wanted time, the total sum is bound
to be <= the wanted iteration time and last calibration time is between 1/4 and
1/2 of the wanted time, so it should give a very accurate loop count.
2010-08-09 19:19:04 +02:00
Benjamin Otte
9ce87c67ff perf: print comment describing backend
Use the descibe string to output information about the backend we're
testing.
2010-07-03 02:55:52 +02:00
M Joonas Pihlaja
b036a09972 whitespace: Fixup formal arguments and tabs in boilerplate/ and perf/.
Ran a script to align the formal parameters of functions and
collapse spaces to tabs in code.
2010-06-24 15:02:53 +03:00
M Joonas Pihlaja
800e977c2e perf: Allow comparing perf reports with only one difference.
The cairo-perf-diff-files tool would ignore perf reports with
just one test for no apparent reason.  The traces take so long
that it's useful to be able to compare runs with just one trace.
2010-06-17 14:27:13 +03:00
Chris Wilson
0d5a15f238 check: Disable running cairo-perf-micro
Since this takes days to run now and should not find any bugs that are
not covered by the test-suite it seems like a pointless exercise.
Especially as I am trying to make a release!
2010-06-12 20:02:39 +01:00
Andrea Canciani
061ea78ad2 perf: Correct cairo-perf-diff syntax
{ cmd-list; } seems to literally be the required syntax. Blanks and
';' are both mandatory.
2010-04-10 18:25:25 +02:00
Chris Wilson
f5f6431787 perf: Switch between micro and trace benchmarks for cairo-perf-diff 2010-04-07 22:50:15 +01:00
Chris Wilson
fe610d559c perf/micro: Show megapixel fill rate during paint. 2010-04-02 08:51:03 +01:00
Andrea Canciani
a81d347c24 perf: Fix timestamp computation on MacOS X
The OIL routines don't work as expected on MacOS X. The operating
system gives access to the timestamp counter through the function
mach_absolute_time.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-03-31 16:13:05 +02:00
Chris Wilson
d2ec151e49 perf/micro: Exercise different sizes and antialising modes with glyphs 2010-03-30 15:28:37 +01:00
Chris Wilson
72481acf0d perf: Compute ops per second
Provide a hook for the test to be able to compute the number of ops per
second. For instance, the glyphs test uses it to report the number of
kiloglyph per second Cairo is able to render.
2010-03-30 15:28:37 +01:00
Chris Wilson
97f8c20727 boilerplate: Create an image16 target
In order to exercise the newly restored r5g6g5 support, we need to
create an appropriate surface and feed it through the test and
performance suites.
2010-03-27 21:53:55 +00:00
Chris Wilson
25a77b263d boilerplate: Cleanup the list of backends upon shutdown. 2010-03-23 16:49:21 +00:00
Chris Wilson
e1f0c2e73f perf: Check for and include unistd.h
isatty() and access() require unistd.h, so include it!
2010-03-04 17:11:58 +00:00
Chris Wilson
411c09eed7 perf: Enable a surface cache for perf-trace
Real applications that control their Drawable externally to Cairo are
'disadvantaged' by cairo-perf-trace when it creates a similar surface
for each new instance of the same Drawable. The difficulty in
maintaining one perf surface for every application surface is that the
traces do not track lifetimes for the application surfaces, so we would
just accumulate stale surfaces. The surface cache takes a different
approach and returns the same surface for each active Drawable, and
maintains a hold-over of the MRU 16 surfaces. This achieves 60-80% hit
rate with firefox, which is probably as good as can be expected.
Obviously for double-buffered applications we only every draw to freshly
created surfaces (and Gtk+ bypasses cairo to do the final copy -- the
ideal application would just use a push-group for double buffering, in
which case we would capture and replay the entire expose event).

To enable use of the surface cache whilst replaying use -c:

  ./cairo-perf-trace -c firefox-talos-gfx
2010-01-22 23:01:46 +00:00
Chris Wilson
8f69481722 gitignore: refresh
Add forgotten local targets to .gitignore
2010-01-22 22:30:43 +00:00
Chris Wilson
f648fcd2f9 gitignore: Add forgotten cairo-perf-print 2009-10-26 11:03:16 +00:00
Chris Wilson
6911ba2f76 perf: Fix comparisons
The sort order was unstable resulting in incorrect ordering dependent
upon libc version.
2009-10-26 11:03:16 +00:00
M Joonas Pihlaja
43a775f60d [meta] Rename cairo_meta_surface_t to cairo_recording_surface_t.
The new name is more descriptive than the rather opaque meta surface.
Discussed with vigour on the mailing list and #cairo:

http://lists.cairographics.org/archives/cairo/2009-July/017571.html
2009-10-22 02:29:47 +03:00
Chris Wilson
f23ae97e30 [perf] Support parsing reports from stdin 2009-09-29 03:03:51 +01:00
Chris Wilson
ccf84a8883 [perf] Reorganise cairo-perf
In preparation to creating a new hub to control performance measuring
and reporting, move the current cairo-perf out of the way.
2009-09-15 18:19:08 +01:00
Chris Wilson
9389cb78a8 [build] Improve handling of missing test apparatus
Improve detection, reporting and disabling of test backends when we lack
the required libraries and utilities.
2009-09-08 17:51:33 +01:00
Chris Wilson
9b932d7cd7 [perf] Move the calibration to its own function
Improve code clarity and whatnot.
2009-09-05 08:46:39 +01:00
M Joonas Pihlaja
270b2f1be0 [perf] Add a fast-and-sloppy mode to cairo-perf.
A new -f option to cairo-perf reverts to a fast run
mode for quick performance overviews. The number of
milliseconds each iteration of a test is run for can
be overriden using the new CAIRO_PERF_ITERATION_MS
environment variable. The default remains 2000 ms/iter.
2009-09-05 05:50:57 +03:00
Chris Wilson
0ffca06d7f [perf] Use milliseconds by default in cairo-perf-diff-files
Necessary when comparing performance reports from different machines (or
even at different CPU states).
2009-09-04 08:32:31 +01:00
Chris Wilson
3acccf0ea5 [perf] Trim outliers from chart
Use "mild outliers" method to remove exceptional speed-ups and slow-downs
from the graph, so that the majority of information is not lost by the
scaling. Add the timing labels to the bars so that the true factor is
always presented.
2009-08-30 12:35:47 +01:00
Vladimir Vukicevic
d7faec024a Add skia backend
Originally written by Vladimir Vukicevic to investigate using Skia for
Mozilla, it provides a nice integration with a rather interesting code
base. By hooking Skia underneath Cairo it allows us to directly compare
code paths... which is interesting.

[updated by Chris Wilson]
2009-08-29 17:07:35 +01:00
Chris Wilson
bdd3c5ba69 [perf] Match directory names
In order to handle 'cairo-perf-trace benchmark', we need to perform the
can_run? test on the directory name as opposed to the individual trace
names. Make it so.
2009-08-29 08:08:26 +01:00
Chris Wilson
77c1109616 [perf] Reset global caches after every trace
I'd disabled this to look at cairo-qt performance, then forgot about it.
Be clean, cleanup globals -- this should fix the huge performance loss
when running in series multiple backends that need separate font caches.
2009-08-29 08:08:25 +01:00
Chris Wilson
9c8e60f771 [perf] Remove cpuset warning for cairo-perf-trace
These traces run for much longer than the original synthetic benchmarks
and seek to replicate 'real-world' applications, so the warning that the
xserver and cairo-perf are not bound to any cpu is false.
2009-08-29 08:08:25 +01:00
Chris Wilson
d07ed5d990 [perf] Add charting utility
cairo-perf-chart takes multiple runs (currently it is limited to
prefiltered data sets) and pretty-prints a chart showing performace
improvements/regressions (in either ASCII or HTML) along with a
cairo-perf-chart.png
2009-08-29 08:08:00 +01:00
Chris Wilson
015eccadcb [perf] Fix unaligned-clip
We failed to reset the scale after each loop, eventually generating a vast
clip-mask that exceeded memory capacity.
2009-08-26 23:51:43 +01:00
Chris Wilson
6f8fae21e6 [perf] Add a box mode to spiral
Add a very similar 'spiral' path (really just concentric boxes) that hit
the rectangular optimisations so that we can compare how effective they
are.
2009-08-26 23:51:43 +01:00
Chris Wilson
e79a9a87c3 [perf] Support objdir!=srcdir in cairo-perf-diff
Crude support to detect when we have cairo-perf-diff-files in the local
directory which is not srcdir.
2009-08-26 23:51:43 +01:00