Bug 446146 - Reloading a brush takes noticeably longer than before
Summary: Reloading a brush takes noticeably longer than before
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Resource Management (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Appimage Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-11-27 01:21 UTC by tomtomtomreportingin
Modified: 2022-06-17 13:35 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tomtomtomreportingin 2021-11-27 01:21:51 UTC
SUMMARY
In 5.0 git e650032 (11/26/21) and 5.1 git 4a272ff (11/26/21), reloading a brush takes significantly longer than it did in 5.0 git e4dfc68 (11/13/21).

STEPS TO REPRODUCE
1. Select Basic-1 brush.
2. Change size.
3. Reload  the brush.

OBSERVED RESULT
The reloading takes about half a second on my end. This delay will also affect other operations such as painting on the canvas right after.

EXPECTED RESULT
The reloading should be instant.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Debian sid
KDE Plasma Version: 5.23.3
KDE Frameworks Version: 5.88.0
Qt Version: 5.12.11 (appimage)
Comment 1 tomtomtomreportingin 2021-11-27 10:00:09 UTC
The lag can easily be observed by setting the action to a shortcut, then pressing the shortcut while painting on the canvas. This lag occurs even when the brush isn't dirty. No such lag occurred in previous versions, therefore this is a regression.
Comment 2 Dmitry Kazakov 2021-12-17 10:50:41 UTC
Hi, TomTomTom!

Halla fixed a bug like that yesterday, could you please recheck with the latest nightlies?

https://binary-factory.kde.org/job/Krita_Stable_Appimage_Build/
Comment 3 apelsinchoklad 2021-12-20 09:44:31 UTC
(In reply to Dmitry Kazakov from comment #2)

Hello Dmitry. I can reproduce the bug in the latest nightlies krita-nightly_50f8936 and krita-nightly_5e7b12a on macOS 10.13.6. It's only really noticeable with many brush bundles installed (and perhaps other resources?). I've got 24 bundles plus the default ones on my system.

I also notice a slowdown when creating a new document with many bundles installed. Should I reopen Bug 446984?
Comment 4 tomtomtomreportingin 2021-12-20 17:19:10 UTC
Yes, I can still reproduce this in 5.0 git 50f8936.
Comment 5 Dmitry Kazakov 2022-06-17 13:33:52 UTC
Git commit cb85d92790e36e2007be62ba58cfb2b47cec2364 by Dmitry Kazakov.
Committed on 17/06/2022 at 12:19.
Pushed by dkazakov into branch 'master'.

Don't include thumbnails into normal SQL queries

It makes the queries too slow to operate. Instead, the thumbnails are
now fetched using a separate query via resource_id.

It increases the speed of KisAllResourcesModel::resetQuery() from
400ms to 0ms (with a lot of bundles active)

M  +0    -1    libs/resources/KisResourceModel.cpp
M  +27   -1    libs/resources/KisResourceQueryMapper.cpp
M  +0    -1    libs/resources/KisTagResourceModel.cpp

https://invent.kde.org/graphics/krita/commit/cb85d92790e36e2007be62ba58cfb2b47cec2364
Comment 6 Dmitry Kazakov 2022-06-17 13:34:00 UTC
Git commit 9936558e9e9978046d42de1af2f08de1b7b3c178 by Dmitry Kazakov.
Committed on 17/06/2022 at 12:19.
Pushed by dkazakov into branch 'master'.

Add an index for resource signature

We need this index to be able to group-by (name,filename,md5)
efficiently. This index makes the query in the KisResourceModel
execute almost instantly.

This patch increases the schema version from 0.0.16 to 0.0.17!

M  +30   -4    libs/resources/KisResourceCacheDb.cpp
M  +1    -0    libs/resources/sql.qrc
A  +1    -0    libs/resources/sql/create_index_resources_signature.sql

https://invent.kde.org/graphics/krita/commit/9936558e9e9978046d42de1af2f08de1b7b3c178
Comment 7 Dmitry Kazakov 2022-06-17 13:34:09 UTC
Git commit c6c6f0d8244353a259096410800dba339b536e4e by Dmitry Kazakov.
Committed on 17/06/2022 at 12:19.
Pushed by dkazakov into branch 'master'.

Don't reset the query when reloading a resource

We don't have to call reset query here, because reloading a resource
doesn't change any database content.

M  +7    -2    libs/resources/KisResourceModel.cpp

https://invent.kde.org/graphics/krita/commit/c6c6f0d8244353a259096410800dba339b536e4e
Comment 8 Dmitry Kazakov 2022-06-17 13:34:58 UTC
Git commit a536585328ee4a9778d62b8d859635490383b554 by Dmitry Kazakov.
Committed on 17/06/2022 at 13:34.
Pushed by dkazakov into branch 'krita/5.1'.

Don't include thumbnails into normal SQL queries

It makes the queries too slow to operate. Instead, the thumbnails are
now fetched using a separate query via resource_id.

It increases the speed of KisAllResourcesModel::resetQuery() from
400ms to 0ms (with a lot of bundles active)

M  +0    -1    libs/resources/KisResourceModel.cpp
M  +27   -1    libs/resources/KisResourceQueryMapper.cpp
M  +0    -1    libs/resources/KisTagResourceModel.cpp

https://invent.kde.org/graphics/krita/commit/a536585328ee4a9778d62b8d859635490383b554
Comment 9 Dmitry Kazakov 2022-06-17 13:35:06 UTC
Git commit 33698b4b8c5e5ebcbedf9a5655a0599dad6c02e8 by Dmitry Kazakov.
Committed on 17/06/2022 at 13:34.
Pushed by dkazakov into branch 'krita/5.1'.

Don't reset the query when reloading a resource

We don't have to call reset query here, because reloading a resource
doesn't change any database content.

M  +7    -2    libs/resources/KisResourceModel.cpp

https://invent.kde.org/graphics/krita/commit/33698b4b8c5e5ebcbedf9a5655a0599dad6c02e8
Comment 10 Dmitry Kazakov 2022-06-17 13:35:14 UTC
Git commit af1722234b5c3579169e82378a63bd43d309ef0e by Dmitry Kazakov.
Committed on 17/06/2022 at 13:34.
Pushed by dkazakov into branch 'krita/5.1'.

Add an index for resource signature

We need this index to be able to group-by (name,filename,md5)
efficiently. This index makes the query in the KisResourceModel
execute almost instantly.

This patch increases the schema version from 0.0.16 to 0.0.17!

M  +30   -4    libs/resources/KisResourceCacheDb.cpp
M  +1    -0    libs/resources/sql.qrc
A  +1    -0    libs/resources/sql/create_index_resources_signature.sql

https://invent.kde.org/graphics/krita/commit/af1722234b5c3579169e82378a63bd43d309ef0e