Bug 244910 - Krita 'Spray Pen' / 'Chalk' use excessive memory & become very slow
Summary: Krita 'Spray Pen' / 'Chalk' use excessive memory & become very slow
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Brush engines (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR critical
Target Milestone: ---
Assignee: LukasT
URL:
Keywords: release_blocker
Depends on:
Blocks:
 
Reported: 2010-07-16 23:44 UTC by J Appel
Modified: 2010-09-16 15:21 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description J Appel 2010-07-16 23:44:59 UTC
Version:           unspecified
OS:                Linux

Krita 2.2.1
KDE 4.4.5 
(both are not selectable with bugzilla at the time of writing)

Drawing gets sometimes very slow with the Spray Pen, the Hair Pen and the Chalk Pen. For the Chalk and the Hair pen it is reproducable any time with the first attempt to draw anything.


Reproducible: Always

Steps to Reproduce:
1. Start a new document, cmyk, 2000x800px (though any new document might do)
2. select the chalk pen, try to draw anything
3. the first few dots are drawn, than the systems freezes. i can watch the memory consumption go up from 100.000k to 400.000 - 800.000k while drawing a simple line with the chalk pen.
4. After a while the rest of the stroke is shown.
Comment 1 J Appel 2010-07-17 00:26:16 UTC
Looks like it is related to the use of the cmyk colorspace, rgb seems to work fine.
Comment 2 Halla Rempt 2010-08-15 16:41:40 UTC
BUGDAY
Comment 3 Michael Leupold 2010-08-22 17:55:10 UTC
While CMYK currently doesn't work for me, I can reproduce this bug on almost ALL colorspaces except RGB and Grayscale, at least using the chalk brush. Drawing only a single line makes memory usage go up to > 2 GB.
Comment 4 Kubuntiac 2010-08-22 18:14:11 UTC
Confirmed by following J Appel's instructions.
1 core of my cpu maxes out with this, too.

TECH SPECS:
Krita revision 1166713
Kubuntu 10.04 32bit
KDE 4.5
QT 4.7.0 beta 2
Comment 5 pentalis 2010-09-04 07:11:12 UTC
The problem is a speed bottleneck in the Chalk paintop.

These lines of code:
KoColorTransformation* transfo = dev->colorSpace()->createColorTransformation("hsv_adjustment", params);
transfo->transform(m_inkColor.data(), m_inkColor.data(), 1);

Take nearly no time to execute in RGB and Greyscale (where there's no saturation). While in CYMK the operation is 100-1000 times slower.

Developers can easily confirm this by using QTime in the source. 
Users can easily confirm this by deactivating Ink Depletion --> Saturation decrease and experience the boost in speed.

I'm currently considering how to achieve the same effect without the speed cost.
A temporary "bugfix" (actually a hint of a workaround for users) is to add a tooltip saying "Warning: slow in colorspaces different from RGB and CYMK".
Comment 6 LukasT 2010-09-16 13:01:22 UTC
SVN commit 1175998 by lukast:

Fix slow chalk in CMYK

o create the transformation only once
o clean up old code and old Windows define for drand48 (it is already in some kdewin lib)
o fix brush outline

CCBUG:244910

 M  +13 -13    chalk_brush.cpp  
 M  +3 -1      chalk_brush.h  
 M  +6 -2      kis_chalk_paintop.cpp  
 M  +3 -20     kis_chalk_paintop_settings.cpp  
 M  +1 -3      kis_chalk_paintop_settings.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1175998
Comment 7 LukasT 2010-09-16 14:22:15 UTC
SVN commit 1176021 by lukast:

Fix slow spray on CMYK

Creating HSV transformation per dab is slow on CMYK colorspace.
Cache it and create it only once.

CCBUG:244910

 M  +12 -9     spray_brush.cpp  
 M  +2 -0      spray_brush.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1176021
Comment 8 LukasT 2010-09-16 15:21:53 UTC
SVN commit 1176041 by lukast:

Fix slow Hairy brush on CMYK.

o create the color transformation once per dab
o clean up the code

BUG:244910

 M  +23 -24    hairy_brush.cpp  
 M  +2 -3      hairy_brush.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1176041