Skip to content

Unreasonably slow #35

@tyoma

Description

@tyoma

I'm developing another graphics library: Anti-Grain Evolution (https://github.com/tyoma/agge). It is based on Maxim Shemanarev's AGG, but is 3 times faster (and leaner in terms of functionality).
So today I performed a simple test and it turns out path drawing in io2d is 6 times slower than I have in AGGE. Should I switch to antialias(io2d::fast) it becomes 3 times slower. But agge always draws in maximum possible quality (it does analytic antialiasing).

This is how I draw path (I eliminated all the obvious memory allocations I could find in the measured interval, _surface and _spiral are created on resize, but never in drawing cycle):

     timings.clearing += stopwatch(counter);

     _surface->line_width(3);
     _surface->line_cap(io2d::line_cap::butt);
     _surface->line_join(io2d::line_join::miter);
     _surface->stroke(io2d::rgba_color(0.0, 154.0 / 255, 1.0));
     _surface->path(*_spiral);

     timings.rasterization += stopwatch(counter);

Can you tell if I'm doing something wrong or is it just Cairo that is so slow?
Being stateful (which is so not C++ish) io2d could make some use of caching, I think...

Below you can see the results are quite similar (all the pixels drawn are within the tolerance of 4 levels), but the timings are hugely different.

cairo-spiral
agge-spiral

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions