Krita slowing down as time passes (after upgrading to 4.4.5)

@dkazakov,

today in the late afternoon I will have time for this, are there things that should get special attention that you definitely want to have tested, or do you “just” want to know if the slowdown described in the topic no longer occurs?

Michelist

Hi, @Michelist!

I just need to know if the patch resolves all the slowdown symptoms described in the thread. I have disabled one subsystem in this package, so if someone confirms it resolves the slowdown, I can move further with fixing the issue.

@raghukamath has already confirmed that the package fixes the “hiccups while painting” problem. But the fix for “slowdown with time” has not been confirmed by anyone yet.

Hi, @all!

I have built an updated package. It has the fix for the memory statistics calculation, so it calculates the stats and doesn’t interrupt painting as well.

Hello @dkazakov,

after using your version for some time, copying and / or moving layers and groups, painting on different layers, working with the selection tools and so on. When moving groups it understandably always took a while until it had “the nodes back in the right place”, then it continued as fast as before, the save operations take a bit longer but that is probably due to the size of the file as you can see in the log. However, Krita aborted with a “safe asset” on the last attempt to save. Without knowing if you can do anything with the normal Krita log, I’m attaching it.

By the way, I would be interested to hear what @Hadriscus says about your last version here, he should be able to judge better than me if something has improved for him.

Oh yes, my configuration is identical to the first one posted in the animation topic.
I’ll stop testing for today, if you have further wishes you can post them here.

================================================================================
SESSION: 07 Jul 2021 15:26:41 +0200. Executing c:\TC_PP\Tools\krita-nightly-x64-5.0.0-prealpha\bin\krita.exe

Krita Version: 4.4.7-alpha (git ce13b40), Qt version compiled: 5.12.8, loaded: 5.12.8. Process ID: 14648
-- -- -- -- -- -- -- --
07 Jul 2021 15:26:41 +0200: Style: fusion. Available styles: windowsvista, Windows, Fusion
07 Jul 2021 15:45:04 +0200: Importing application/x-krita to application/x-krita. Location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/Himmel die Berge ... Test.kra. Real location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/Himmel die Berge ... Test.kra. Batchmode: 0
07 Jul 2021 15:45:14 +0200: Loaded image from application/x-krita. Size: 4960 * 3508 pixels, 4.16667 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 82
07 Jul 2021 15:46:43 +0200: Importing application/x-krita to application/x-krita. Location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/Ebeneezer.kra. Real location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/Ebeneezer.kra. Batchmode: 0
07 Jul 2021 15:46:52 +0200: Loaded image from application/x-krita. Size: 4960 * 3508 pixels, 4.16667 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 75
07 Jul 2021 15:47:02 +0200: Importing application/x-krita to application/x-krita. Location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/demo.kra. Real location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/demo.kra. Batchmode: 0
07 Jul 2021 15:47:52 +0200: Loaded image from application/x-krita. Size: 3000 * 3000 pixels, 4.16667 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 121
07 Jul 2021 15:49:11 +0200: CLOSING SESSION
================================================================================
SESSION: 07 Jul 2021 15:57:32 +0200. Executing c:\TC_PP\Tools\krita-nightly-x64-5.0.0-prealpha\bin\krita.exe

Krita Version: 4.4.7-alpha (git ce13b40), Qt version compiled: 5.12.8, loaded: 5.12.8. Process ID: 28900
-- -- -- -- -- -- -- --
07 Jul 2021 15:57:32 +0200: Style: fusion. Available styles: windowsvista, Windows, Fusion
07 Jul 2021 15:58:26 +0200: Importing application/x-krita to application/x-krita. Location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/Ebeneezer.kra. Real location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/Ebeneezer.kra. Batchmode: 0
07 Jul 2021 15:58:34 +0200: Loaded image from application/x-krita. Size: 4960 * 3508 pixels, 4.16667 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 75
07 Jul 2021 15:58:46 +0200: Importing application/x-krita to application/x-krita. Location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/demo.kra. Real location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/demo.kra. Batchmode: 0
07 Jul 2021 15:59:33 +0200: Loaded image from application/x-krita. Size: 3000 * 3000 pixels, 4.16667 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 121
07 Jul 2021 16:09:00 +0200: CLOSING SESSION
================================================================================
SESSION: 07 Jul 2021 16:09:01 +0200. Executing c:\TC_PP\Tools\krita-nightly-x64-5.0.0-prealpha\bin\krita.exe

Krita Version: 4.4.7-alpha (git ce13b40), Qt version compiled: 5.12.8, loaded: 5.12.8. Process ID: 28988
-- -- -- -- -- -- -- --
07 Jul 2021 16:09:01 +0200: Style: fusion. Available styles: windowsvista, Windows, Fusion
================================================================================
SESSION: 07 Jul 2021 16:12:08 +0200. Executing c:\TC_PP\Tools\krita-nightly-x64-5.0.0-prealpha\bin\krita.exe

Krita Version: 4.4.7-alpha (git ce13b40), Qt version compiled: 5.12.8, loaded: 5.12.8. Process ID: 23388
-- -- -- -- -- -- -- --
07 Jul 2021 16:12:08 +0200: Style: fusion. Available styles: windowsvista, Windows, Fusion
07 Jul 2021 16:12:08 +0200: CLOSING SESSION
================================================================================
SESSION: 07 Jul 2021 16:14:00 +0200. Executing c:\TC_PP\Tools\krita-nightly-x64-5.0.0-prealpha\bin\krita.exe

Krita Version: 4.4.7-alpha (git ce13b40), Qt version compiled: 5.12.8, loaded: 5.12.8. Process ID: 1040
-- -- -- -- -- -- -- --
07 Jul 2021 16:14:00 +0200: Style: fusion. Available styles: windowsvista, Windows, Fusion
07 Jul 2021 16:15:57 +0200: Importing application/x-krita to application/x-krita. Location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/Ebeneezer.kra. Real location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/Ebeneezer.kra. Batchmode: 0
07 Jul 2021 16:16:05 +0200: Loaded image from application/x-krita. Size: 4960 * 3508 pixels, 4.16667 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 75
07 Jul 2021 16:19:41 +0200: Importing application/x-krita to application/x-krita. Location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/demo.kra. Real location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/demo.kra. Batchmode: 0
07 Jul 2021 16:20:27 +0200: Loaded image from application/x-krita. Size: 3000 * 3000 pixels, 4.16667 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 121
07 Jul 2021 16:21:39 +0200: Importing application/x-krita to application/x-krita. Location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/demo_001.kra. Real location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/demo_001.kra. Batchmode: 0
07 Jul 2021 16:22:30 +0200: Loaded image from application/x-krita. Size: 3000 * 3000 pixels, 4.16667 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 120
07 Jul 2021 16:35:28 +0200: Autosaving: D:/_do it myself/mein Krita Output/ TEMP T E S T !/.demo.kra-autosave.kra
07 Jul 2021 16:35:28 +0200: Converting from application/x-krita to application/x-krita. Location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/.demo.kra-autosave.kra. Real location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/.demo.kra-autosave.kra. Batchmode: 0. Configuration: none
07 Jul 2021 16:35:46 +0200: Completed saving D:/_do it myself/mein Krita Output/ TEMP T E S T !/.demo.kra-autosave.kra (mime: application/x-krita). Result: OK. Size: 959843074. MD5 Hash: FILE_BIGGER_10MB
07 Jul 2021 16:37:31 +0200: Autosaving: D:/_do it myself/mein Krita Output/ TEMP T E S T !/.demo_001.kra-autosave.kra
07 Jul 2021 16:37:32 +0200: Converting from application/x-krita to application/x-krita. Location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/.demo_001.kra-autosave.kra. Real location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/.demo_001.kra-autosave.kra. Batchmode: 0. Configuration: none
07 Jul 2021 16:37:50 +0200: Completed saving D:/_do it myself/mein Krita Output/ TEMP T E S T !/.demo_001.kra-autosave.kra (mime: application/x-krita). Result: OK. Size: 959493032. MD5 Hash: FILE_BIGGER_10MB
07 Jul 2021 16:50:52 +0200: Autosaving: D:/_do it myself/mein Krita Output/ TEMP T E S T !/.demo.kra-autosave.kra
07 Jul 2021 16:50:53 +0200: Converting from application/x-krita to application/x-krita. Location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/.demo.kra-autosave.kra. Real location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/.demo.kra-autosave.kra. Batchmode: 0. Configuration: none
07 Jul 2021 16:51:15 +0200: Completed saving D:/_do it myself/mein Krita Output/ TEMP T E S T !/.demo.kra-autosave.kra (mime: application/x-krita). Result: OK. Size: 1175757408. MD5 Hash: FILE_BIGGER_10MB
07 Jul 2021 17:03:37 +0200: Saving Document D:/_do it myself/mein Krita Output/ TEMP T E S T !/demo_001.kra as D:/_do it myself/mein Krita Output/ TEMP T E S T !/demo_002.kra (mime: application/x-krita). 3000 * 3000 pixels, 178 layers.  101 frames, 24 framerate. Export configuration: No configuration
07 Jul 2021 17:04:05 +0200: Converting from application/x-krita to application/x-krita. Location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/demo_002.kra. Real location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/demo_002.kra. Batchmode: 0. Configuration: none
07 Jul 2021 17:04:33 +0200: Completed saving D:/_do it myself/mein Krita Output/ TEMP T E S T !/demo_002.kra (mime: application/x-krita). Result: OK. Size: 1541835631. MD5 Hash: FILE_BIGGER_10MB
07 Jul 2021 17:04:33 +0200: Removing autosave file: D:/_do it myself/mein Krita Output/ TEMP T E S T !/.demo_001.kra-autosave.kra
07 Jul 2021 17:04:33 +0200: Saving Completed
07 Jul 2021 17:19:18 +0200: Autosaving: D:/_do it myself/mein Krita Output/ TEMP T E S T !/.demo.kra-autosave.kra
07 Jul 2021 17:19:19 +0200: Converting from application/x-krita to application/x-krita. Location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/.demo.kra-autosave.kra. Real location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/.demo.kra-autosave.kra. Batchmode: 0. Configuration: none
07 Jul 2021 17:19:40 +0200: Completed saving D:/_do it myself/mein Krita Output/ TEMP T E S T !/.demo.kra-autosave.kra (mime: application/x-krita). Result: OK. Size: 1175847109. MD5 Hash: FILE_BIGGER_10MB
07 Jul 2021 17:34:07 +0200: Saving Document D:/_do it myself/mein Krita Output/ TEMP T E S T !/demo.kra as D:/_do it myself/mein Krita Output/ TEMP T E S T !/demo_003.kra (mime: application/x-krita). 3000 * 3000 pixels, 200 layers.  101 frames, 24 framerate. Export configuration: No configuration
07 Jul 2021 17:34:08 +0200: Converting from application/x-krita to application/x-krita. Location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/demo_003.kra. Real location: D:/_do it myself/mein Krita Output/ TEMP T E S T !/demo_003.kra. Batchmode: 0. Configuration: none
07 Jul 2021 17:34:41 +0200: Completed saving D:/_do it myself/mein Krita Output/ TEMP T E S T !/demo_003.kra (mime: application/x-krita). Result: OK. Size: 1688489491. MD5 Hash: FILE_BIGGER_10MB
07 Jul 2021 17:34:41 +0200: Removing autosave file: D:/_do it myself/mein Krita Output/ TEMP T E S T !/.demo.kra-autosave.kra
07 Jul 2021 17:34:41 +0200: Saving Completed
07 Jul 2021 17:40:20 +0200: SAFE ASSERT (krita): "m_strokeId" in file C:/dev/env-3/krita/plugins/tools/basictools/kis_tool_move.cc, line 308

Michelist

Hi @dkazakov - thanks a lot for your hard work :slightly_smiling_face:

First let me repeat, that I didn’t experience the slow down over time as described by the OP - so I may not be the best tester in this case. With both versions you posted, I still see the same effects that I described earlier. Though it’s pretty much the same with older versions, as far as I can tell - so no regression here.

A bit more about the CPU fluctuations after undoing merge operations:

  • they seem to occur only with vector layers with transform masks
  • no fluctuations with “pure” vector layers
  • no fluctuations with paint layers with transform masks either
  • fluctuations are stopped by performing any other merge

All tests were performed with @raghukamath 's demo file and variations thereof (added groups/layers, deleted stuff etc.). Overall I get the impression, that Krita performs often unnecessary re-calculations after moving nodes, even when the operation doesn’t change the resulting image in any way. If you want me to try anything specific, please say so.

Ahah yes you’re right.
But for my own, I can’t be on all bug testing :sweat_smile:

Also due to lack of time, I didn’t took time to use Krita for drawing from a while now :disappointed_relieved:

That’s a problem I already saw in Krita 4.2.8, where just moving a node could take from 15 to 60 minutes (according to document, that’s not always the case), but from Krita 4.2.8 I tested all versions (even the krita-4.4.7-alpha-ce13b40-x86_64.appimage — Яндекс.Диск and last Krita 5 appimage) and problem never gone

Grum999

Translated with DeepL, don’t have time to do it by hand right now, sorry.

Wow, up to 60 minutes to move nodes is crass! With the image that triggered the “Safe Asset” yesterday, it was a maximum of 2 minutes, but usually much less and the image has changed every time I duplicated groups and these duplicated groups, inserted into other groups. The file size is about 1.5 GB on the hard disk and over 10 GB in the Krita title bar.
What is still true is that after these node updates I can continue working at the pace of before, deselecting a selection happens immediately and not after many seconds as described by the OP, also pasting cut selections happens without delays.

So the node updates seem to be the problem here, am I right?

Michelist

However, Krita aborted with a “safe asset” on the last attempt to save

This assert looks to be unrelated to the original problem :slight_smile:

Hello @dkazakov, Hello @All!

Have now tested further with the file demo_001.kra (121 layers) provided by @raghukamath. Since the file is a small file according to @raghukamath’s description, I have greatly expanded it (711 layers, nested to a depth of 9 (Beyond that, I got into the area where swapping became necessary and I would have had to allocate even more memory.)). It can be seen that creating and moving nodes takes much longer the larger the file gets (currently ~ 5.5 GB on disk).

Up to 10 layers can be handled quite well at once, the node operations take a few seconds, up to 20 layers it becomes a just tolerable minute for the node operations, but as soon as you copy or move larger groups (more than 20 layers) you have to wait a long time, sometimes up to 10 minutes before you can continue working. It’s …! :face_vomiting:

Once one of the node operations is complete, selecting, cutting, pasting, deselecting, vector object manipulations, transforming large selections et cetera work as fast as ever. In my eyes, the node operations are the problem.

Okay, the original file from @raghukamath could be edited smoothly, but the point I have reached in the meantime is ABSOLUTELY NO FUN ANYMORE! Anyone who uses Krita to make a living definitely has a problem with this situation. Fortunately, this is a hobby for me. :wink:

Michelist

As far as I can tell, the workaround for Krita 4.4.6 would be to add the following like to kritarc file manually:

memoryPoolLimitPercent=0.1

Normally the pool is disabled (because the benefits of it are considered to have only placebo effect), but the pool also calculates the memory statistics. This line will enable the pool with very small size (0.1% of total memory), which should be enough to activate it and calculate the memory statistics in the background (instead of during painting).

If this setting solves the initial stutter we get during drawing a stroke, can we have this as default in future release.

I will try the appimage again to see if there is any other issue. One of the issue was time taken for normal task such as moving layer, hiding unhiding layers would take time, see the initial screenshots attached by me showing the progress dialog that would pop up when doing simple operations such as deleting the layer or group

If this setting solves the initial stutter we get during drawing a stroke, can we have this as default in future release.

In the future release we’ll have a proper fix and there will be no need to activate a pooler for this sake. This option is just a workaround to the fact that we cannot release an updated version of 4.x branch anymore…

Hello @dkazakov!

Inserting this parameter here has the effect that the file that could be opened by Krita yesterday within a short time, Krita has been busy opening this file for 90 minutes now, but the progress bar is moving to the right - really, it’s progressing :wink:

Michelist

Hello @dkazakov, @raghukamath, @Hadriscus, @All!

Wow, the file mentioned today at noon took 104 minutes to open!
The behavior has changed only slightly, it is at least “felt a bit faster”, I stopped testing with the file after it hung with “Assert”. (Edit: I wrote Safe Assert first)
Today late afternoon I tried it with the original files of @Hadriscus and @raghukamath. With their files in their original state, I have much less waiting time when it’s “move nodes” again after copying and moving larger amounts of layers and whole groups, but again you can paint, cut, select and deselect normally when he’s done with the nodes. Still it is not fun.

Michelist

Translated with DeepL, was lazy, and have a headache

Added the following because I saw @Grum999’s Post:

09 Jul 2021 18:25:36 +0200: ASSERT (krita): "hash != KeyTraits::NullHash" in file C:/dev/env-3/krita/libs/image/3rdparty/lock_free_map/leapfrog.h, line 161
09 Jul 2021 18:25:52 +0200: ASSERT (krita): "hash != KeyTraits::NullHash" in file C:/dev/env-3/krita/libs/image/3rdparty/lock_free_map/leapfrog.h, line 199

Ouch! 60 minutes waiting would drive me crazy! Thanks for linking to the other thread - seems there were transform masks involved there too?

Well, I’ve thought a bit about this…perhaps I was a bit too harsh with my judgement. It may not be possible to do much about it. I guess it’s a trade-off between CPU and RAM usage: i.e. in order to avoid those seemingly unnecessary re-calculations, the transformed (or filtered) layer contents would have to be cached, thus driving up the RAM usage significantly. Maybe a compromise would be possible though, for instance caching the top-level groups’ images? Just an idea… I’m not a programmer.

@dkazakov I tried painting and working with AppImage from master. The strokes are now not getting stuck at the beginning. The slowdown is gone from most places. They are only limited to hiding unhiding layer groups, moving layer and groups which consist of vector layer, transform masks and layer styles.

I wonder what made the hiccups so much worse…

I’ve always had them after a few hours ever since I started to use krita more seriously (4.1.x), but when I tried to paint something a few days ago with master, even on a 2k x 2k image with only 3 layers it became unbearable after only 10 minutes of sketching.

After I pulled the fix it seems okay, at least for this not very demanding project. But from what I understand this basically hides the symptoms and not really fix what made it perform so much worse now.

Yes, I was amidst a big project, where I had various groups for different illustrations in one file. I am embarrassed to say that I seriously thought to switch to GIMP for completing the project in time even though it doesn’t have other features. The recent changes reduce the annoyance to some extent.

The main issue is that it is hard to pinpoint step-by-step procedure to reproduce this issue. The waiting for image operation to complete dialog resurfaces like a villain in unexpected time. And I suspect it has something to do with how canvas gets refreshed or how some things get calculated. For now, I have found the major culprits being file size, transform mask, vector layers, and layer styles.

There is a similar bug report and the layer setup shows the bug reporter is using Layer FX too
https://bugs.kde.org/show_bug.cgi?id=440005