Bug 434131

Summary: Lots of layers = UI lag
Product: [Applications] krita Reporter: Manga Tengu <mangatengu>
Component: UsabilityAssignee: Krita Bugs <krita-bugs-null>
Status: REPORTED ---    
Severity: normal CC: ghevan, halla
Priority: NOR Keywords: triaged
Version: 4.4.3-beta1   
Target Milestone: ---   
Platform: macOS (DMG)   
OS: macOS   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Manga Tengu 2021-03-08 08:23:34 UTC
Having lots of layers make the document tab and the layer docker sluggish.

The use case is the following: On a single file, I storyboard a chapter of my webtoon series. A chapter is 40 to 80 panels long. I draw each panel on a separate layer. Then, I have a script Wolthera helped me to develop, that exports each layer to a separate file so I get the real skeleton of my chapter ready.

So I end up with lots and lots of layers. Since the script is recursive, I can have folders containing subfolders of layers, etc. and everything works fine. But layer navigation becomes extremely laggy...

To reproduce:
make an A3 at 300 dpi document 
add something like 50 layers to it.
Try to navigate smoothly. The only thing that will kinda work smoothly is dragging a layer.
Comment 1 Halla Rempt 2021-03-08 08:59:55 UTC
I made a document like that, with about sixty layers some of them in some groups, and pgup/pgdn was instant, ctrl-pgup/ctrl-pgdn was instant, d&d was instant -- which navigation tasks were slow for you? And could you perhaps share privately a file where you observe the slowdown?
Comment 2 Manga Tengu 2021-03-08 09:02:51 UTC
Yes I have 2 concrete files that, if opened together, moving layers up and down or just changing selection is sluggish. How shall I share these ? (around 20 MB)
Comment 3 Halla Rempt 2021-03-08 09:12:23 UTC
A google drive link or dropbox link shared with vurian@gmail.com would work for me.
Comment 4 Manga Tengu 2021-03-08 09:16:36 UTC
Done ! Thank you.
Comment 5 Halla Rempt 2021-03-08 10:00:30 UTC
Got it. On Linux, I don't see performance problems, so I'm trying on my mac now.
Comment 6 Halla Rempt 2021-03-08 10:06:37 UTC
Hm... On my powerbook m1, I also don't see any lag, not when switching between files, not changing the current layer or moving the current layer in the layer stack. The files really aren't excessively big, too.

I've tried both with canvas acceleration on and off.
Comment 7 Manga Tengu 2021-03-08 10:07:31 UTC
changing layer and moving layers should be laggy
Comment 8 Halla Rempt 2021-03-08 10:29:00 UTC
Yes, those are the actions I tried: it's all instant on test hardware -- the M1 macbook pro and my t470p.
Comment 9 Manga Tengu 2021-03-08 10:44:24 UTC
I'm at a loss. It's super slugish here and I have no clue what causes it...
Comment 10 Halla Rempt 2021-03-08 10:54:39 UTC
Me too... Even on my 2015 macbook pro, it's not really sluggish. It's slower than the t470 and the M1, of course, since it's pretty old hardware by now, but it's perfectly usable :-(
Comment 11 Manga Tengu 2021-03-08 10:55:54 UTC
is there anything else I can provide ? Except recording a useless video ?
Comment 12 Bug Janitor Service 2021-03-09 04:33:34 UTC
Thanks for your comment!

Automatically switching the status of this bug to REPORTED so that the KDE team
knows that the bug is ready to get confirmed.

In the future you may also do this yourself when providing needed information.
Comment 13 Halla Rempt 2021-09-08 09:40:14 UTC
No... I cannot imagine anything that would help me figure out what is up with that file on your mac, but not on my mac.
Comment 14 vanyossi 2021-09-13 07:33:50 UTC
How sluggish?? I find it slow, 1 second after click release, but that is with 2 layers and I get the following message.

2021-09-13 02:24:14.819649-0500 krita[25485:4741113] [krita] CGImageDestinationAddImage:3997: *** ERROR: CGImageDestinationAddImage: cgImage is nil
2021-09-13 02:24:14.819672-0500 krita[25485:4741113] [krita] finalizeDestination:3117: *** ERROR: image destination must have at least one image

The message is not shown if the arrows in the docker are used and the change is much faster.  Adding 100 file layers and 20 normal layers has no effect on time the delay layers.
Comment 15 Manga Tengu 2021-09-13 07:46:16 UTC
It could go from half a second to a full second or more.
It slows down proportionally to the number of layers in all the documents open. The more open docs simultaneously, the more it shows. I have stopped using keyboard shortcuts to navigate through layers as it became way too slow and I now click with the mouse to avoid the slowness. This is only on mac.