notes on Inkscape's canvas performance and caching, with GPU summary.
There was some discussion on dev-chat about using SVG for rendering rotation handles and performance and bitmaps came up in discussion.
This should provide a thinking point for talking about canvas performance at Fridays meeting.
That led me onto some investigation into Inkscapes canvas performance when rendering bitmaps and vectors and how chrome handles it. This is about the only benefit of running on an old laptop.
Anyhow, the notes cover the whole file and subfile (z-order sandwich) caching for all possible dynamic transforms of objects (that is excluding node, filter, style modification etc...) which should dramatically improve the performance of inkscape in anything to do with dynamic transformation where perfect fidelity isn't so critical because it's blurred to the eye. It's also very practical on the GPU which has enough fast memory and image filtering technologies to offer good support and high fidelity with no noticeable artifacts in the rendering.
oliverthered 9:48 PM I just had a bit of a look at image drawing performance and there is lag when I'm dragging the image. That means the image position is being updated with intermediary points when the mouse has long left that point. scrolling the view point doesn't seem to have these issues, the performance is still slower than my web browser. That may be because the browser renders to over-view-size bitmaps, or a composite of bitmaps and caches them, so all scrolling involves is translating the cached bitmap.
oliverthered 10:00 PM
vector performance doesn't seem too bad, it's still not great though. does it use intermediary bitmaps with an alpha channel that are cached so that translating and scaling etc.. operations operate with optimum performance?
in a similar way to how true type font rendering works in most applications, except with layers.
so say when you select something the objects with z-orders above and below the selection are cached to bitmaps as layers so they don't have to be rendered for every update.
obviously you get a sandwich effect if the selected objects aren't in a z-order group.
oliverthered 11:16 PM
me running out of memory/swapping or whatever causes chrome to show it's caching system for rendering and it uses square tiles (deciles) when rendering this svg file. with square tiles it's easy to clip the vectors so you can minimize redraw because in addition they over size the view.
oliverthered 11:45 PM
looking at inkscape, when the canvas size is larger than the view area +-42? inkscape resorts to redrawing the portions of the svg file that are out of view when they come back into view. where as chrome uses deciles so that at most the content of the squares are redrawn if they move back into view and are no longer in cache and at least the squares cache the content once it's been drawn once (in an over sized view that is square by square proportioned) it's cached and doesn't have to be drawn again for translation exercises. with decent filtering square caching can also be used for scale, rotate and skew with the svg file only being needed to be redrawn when it's enlarged beyond the cache size. There's a possibility that this may produce some unwelcome artifacts in studio production though so it may only be workable during dynamic operations with the svg file having to be redrawn once the dynamic (and so blurred by the eye) operation is complete to give production quality fidelity again.
oliverthered 11:50 PM
so all dynamic transforms of svg objects can use bitmap caching deciles as mentioned about along with the sandwich caching I mentioned earlier when a fraction of the svg file is modified, nodes, transform, properties, filters etc... This should work very well on the GPU too as it's ideal for this kind of compositing.
That should cover animated transforms and path movement (esp in CSS) and with clipping changes to styles and filters and possibly node movement. It should be possible to parse this information out of the file so caching can be optimized with advanced knowledge and not have to be done with "on the fly" optimization for the various fragments which would get messy.
participants (1)
-
NASA Jeff