[cairo] Division

Billy Biggs vektor at dumbterm.net
Mon Aug 15 21:29:54 PDT 2005


  When running some line and text drawing benchmarks under cairo, a
curious symbol that's often near the top is "__divdi3".  This is a gcc
symbol which implements 64 bit division.  For the 'textpath' [1]
benchmark to an image surface, oprofile puts it at 16% on my machine[2].


  divdi3 can be found here in cairo:

    cairo-traps.c:559   _compute_x
      - Computing the position along a line.
      - This is the major offender.

    cairo-pattern.c:982 _cairo_pattern_calc_color_at_pixel
      - Calculating the factor for the shader function.

    cairo-wideint.c:48  cairo_uint64_divrem
      - Currently unused.


  It can also be found here in pixman:

    renderedge.c
      - 64 bit division is used when moving along a line.  This is the
        second worst offender.

    fbcompose.c
      - Used for bilinear interpolation, at least, two per pixel. Ugh.

    ictrap.c:71  pixman_line_fixed_x
      - Position along a line, same as cairo-traps.c.

    ictransform.c:56  pixman_transform_point
      - Currently unused, I think.


  Changing the calculations in renderedge.c and cairo-traps.c speeds up
my textpath benchmark by 16%, so the overhead seems quite significant.

  Does anyone have any thoughts on how we can improve this?  We could
probably reduce many of these to 32 bits, but I am wondering if there
are some higher-level optimizations that might be appropriate here.

  -Billy

  [1] http://freedesktop.org/~vektor/cairo-benchmarks-0.2.tar.gz
  [2] Intel P4 3.00GHz, model 4, stepping 1



More information about the cairo mailing list