Skip to content

SharedImageSurface refactors and performance improvements

Ivan Molodetskikh requested to merge YaLTeR/librsvg:filters-to-rust-10 into master
  • Unified BadIntermediateSurfaceState and IntermediateSurfaceCreation in FilterError. This allows refactoring SharedImageSurface methods to create SharedImageSurface-s in them (since there's now no need to split the two cairo::Status error types) and generally simplify some code. It's possible to tell which one of the two it was by looking at the cairo::Status anyway I think.
  • Refactored SharedImageSurface and srgb:: methods to return SharedImageSurface.
  • Implemented the alpha_only flag for SharedImageSurface-s.
  • Added some alpha_only optimizations.
  • Marked PixelRectangle::next() as #[inline(always)].

All of this reduced the mobile phone rendering time from 40 to 29 seconds on my PC and svg1.1/filters-*.svg with -p 1 -r 100 by 1 second.

Here are some flamegraphs for the mobile phone (perf record --call-graph=dwarf ./rsvg-convert -o /dev/null mobile_phone_01.svg):

  • Before the main optimizations. The large part in the middle is two gaussian blurs, taking up 50.63% of the time:

perf.svg

  • After, gaussian blurs take up 36.98% of the time:

perf3.svg

Edited by Ivan Molodetskikh

Merge request reports