I was playing with setForeGroundColor() method, and I faced to performance issue.
Maybe it’s just I missed something, I don’t know, but I’ve executed the following code:
from krita import * import time av=Krita.instance().activeWindow().activeView() color=QColor(Qt.black) ts=time.time() for i in range(255): color.setRed(i) mc=ManagedColor.fromQColor(color, av.canvas()) av.setForeGroundColor(mc) print(time.time()-ts)
Tested on Krita 4.4.2 stable + last 5.0.0prealpha, Linux Appimage
- Running on my AMD FX-8350 / 32GB RAM ==> 11s
- Running on my Intel i7-6600U 2.6GHz / 16GB RAM ==> 0.5s
If I put in comment instruction
av.setForeGroundColor(mc) execution time (AMD computer) is around 0.01s
So problem is not to convert a QColor to ManagedColor as I was thinking at the beginning, but on method used to set foreground color.
(same problem occurs with
Problem seems to be relative to my configuration (as it run x20 faster on my laptop)
But I’m not able to understand why.
I’ve deactivated all plugins, hidden all color dockers, … but no change in final execution time.
Both executions made on a default RGBA 8bits document.
Anyone have an idea about why this is so slow one on my computer and not the other one?
Am I the only one facing this problem?