[cairo] Tiny SVG performance improvement

Steve Snyder swsnyder at insightbb.com
Wed Jan 31 03:33:02 PST 2007

On Wednesday 31 January 2007 5:06 am, Daniel Amelang wrote:
> On 1/30/07, Steve Snyder <swsnyder at insightbb.com> wrote:
> > Hello, all.
> >
> > I submitted this to Mozilla, and it was suggested that I report it
> > here as well:  https://bugzilla.mozilla.org/show_bug.cgi?id=368408
> Interesting parts from the report:
> "...SVG performance is terrible..."
> "...Profiling shows that about 40% of the execution time is spent in
> Microsoft's _lldiv() routine..."
> "...The problem is that 32-bit CPUs are just crushed by the repeated
> 64-bit fixed-point division used in _compute_x()..."
> "...This patch avoids the 64-bit division in _compute_x() where
> possible..."
> "...In the benchmark
> http://www.hixie.ch/tests/adhoc/svg/perf/002-with-workarounds-for-asv3.
>svg the
> 64-bit division is avoided about 80,000 times, or 1% (yes, one percent)
> of the of the total calls to _compute_x()..."
> (Me thinking: it would be nice to turn that SVG into a perf test)
> "...For the Tab Preview feature of SeaMonkey _compute_x() is called
> for every preview but it seems that the division can be avoided 100%
> of the time..."
> So, nothing from me yet; just facilitating discussion.

From my skimming of the Cairo mailing list archives it seems that each new 
release brings an announcement of improved performance, so perhaps my bug 
report is based on obsolete circumstances.  

However the performance I reported is in code that Mozilla is shipping 
*now*, and that performance reflects the behavior that users are seeing 
today, with current releases.  I offered that tiny improvement to Mozilla 
as a low-risk patch to an established product.  Low-risk because it can 
be readily seen that there is no point in doing that costly division if 
we've already established that the dividend is zero.

Regarding that benchmark, see http://www.hixie.ch/tests/adhoc/svg/perf/ 
for more of the same.  I just think that the tiger looks cool.  :-)

Thanks for the response.

More information about the cairo mailing list