Performance issues when adjusting gradients in documents with high number of gradients

Bug #1530198 reported by Mark Riedesel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Triaged
Undecided
Unassigned

Bug Description

While working on http://klowner.com/wallpaper/christmas_tux_2015 I encountered a very irritating performance issue when attempting to adjust gradients. The issue became progressively worse as I neared completion of the document.

I did some profiling with gperftools and it showed a ton of calls to sp_gradient_to_pixbuf, from there I determined that the gradient thumbnail lists on both the Tool Controls Bar as well as the Fill and Stroke were clearing their entire list of gradients and rebuilding them on each mouse drag event while adjusting gradients on shapes.

I removed the event handlers for the related situations and it increased performance dramatically with no ill effects (at least as far as I can tell). This change is included in the attached patch.

To reproduce, open this file with 600+ gradients
http://klowner.com/wallery/christmas_tux_2015/download/ChristmasTux2015.svg

Then using the gradient tool, move the gradient on the nearest penguin's bonnet or something and notice the latency.

Issue encountered on Arch Linux, in Inkscape 0.91-15 and trunk. The included patch is against trunk.

I was seeing something like 200-500ms latency on the following machines:
 Intel(R) Core(TM) i7 CPU 960 @ 3.20GHz (4-core, 24GB ram)
 Intel(R) Core(TM) i7-5820K CPU @ 3.30GHz (6-core, 32GB ram)
 both Arch Linux (GNU/Linux 4.2.5-1-ARCH x86_64)

FailBit confirmed bug on
 Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
 Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-63-generic x86_64)

Revision history for this message
Mark Riedesel (mriedesel) wrote :
su_v (suv-lp)
tags: added: gradient performance ui
Revision history for this message
Mark Riedesel (mriedesel) wrote :
description: updated
description: updated
description: updated
description: updated
description: updated
Revision history for this message
Mc (mc...) wrote :

Hi, thank you for taking the time to report and propoe a patch for this issue !

I tested your patch and noticed a regression : when duplicating a gradient, the UI does not show the duplicated gradient (selecting another object triggers an update and shows it).
From what I saw your patch completely prevents redrawing the gradient UI when "modifying defs", I'm not sure if there are other cases where defs are modified when the fill&stroke tab is open that would be impacted (or if other components are affected, maybe auto palette/swatches but i did not test it)

Changed in inkscape:
status: New → Confirmed
Revision history for this message
Mark Riedesel (mriedesel) wrote :

Ah-ha, a regression certainly won't do. I'll investigate a bit more on my end.

Maybe there's some flag or something in the event that indicates whether it's a gradient adjustment or whatever and avoid redraws in that specific situation? I'm not too familiar with Inkscape's codebase.

Revision history for this message
jazzynico (jazzynico) wrote :

Related to (or duplicate of) bug #1416964 "The Complex Gradient in Many Object is Too Slow"?
<https://bugs.launchpad.net/inkscape/+bug/1416964>

Changed in inkscape:
status: Confirmed → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.