Krita 5.0.2 very slow to start

I just downloaded Krita 5.0.2 AppImage (Ubuntu) after previously using Krita 4.x. I noticed that it is very slow to start every time, staying on the splash screen for 39 seconds. Krita 4.x loads in about 10 seconds.

Most of that time is spent reading from the Krita_*_Default_Resources.bundle files. Is that data supposed to be cached in resourcecache.sqlite? Currently I have to wait the 40 seconds every time I start Krita.

Hi

In normal case yes, once SQLite file is built, default resources bundle are not imported anymore and startup should be fast.

The question is why on your side, Krita seems to import bundle at every startup… :thinking:

Which size is the sqlite file?
Can you check it before starting Krita?

Grum999

Yes…it is slower it seems…and I think somehow I started or partially started or something double instances on my Win 11 machine and caused a crazy issue with stylus/cursor lagging/freezing/…

My resourcecache.sqlite is 45M. Not sure why I’m rescanning the bundles every time … Maybe I should file a bug?

It is slow but acceptable I guess.

The problem is more, if Krita rebuild the resource cache at each startup, there’s might be a problem somewhere.
Also, not sure the resource cache is not corrupted or not, and if you start to customize your resources (tags, …) you might loose everything at startup

@ericjpaint When starting Krita from command line, you should have some information in console
Example on my side, if I delete resource cache file, at startup I have this:

krita.lib.resources: Created table "version_information"
krita.lib.resources: Created table "storage_types"
krita.lib.resources: Created table "resource_types"
krita.lib.resources: Created table "storages"
krita.lib.resources: Created table "tags"
krita.lib.resources: Created table "resources"
krita.lib.resources: Created table "versioned_resources"
krita.lib.resources: Created table "resource_tags"
krita.lib.resources: Created table "metadata"
krita.lib.resources: Created table "tags_storages"
krita.lib.resources: Created table "tag_translations"
krita.lib.resources: Created table "storages"
krita.lib.resources: Created table "versioned_resources"
krita.lib.resources: Filled lookup table storage_types
krita.lib.resources: Filled lookup table resource_types
krita.lib.resources: Filled version table

Do you have it in console at each startup?
Or additional (error) messages?
If you delete the resource cache file, the problem persist on each startup?

Grum999

I think my list is just big to load up. I did not try that yet.

You mean, you have the same problem at startup?

Grum999

I did not measure but I tend to take about a good minute.

It seems not to be normal.

Normally, once resources file is built, startup is fast.
On my side, with a 200MB resource file with hundred of brushes startup take a couple of seconds.
So there’s might be a problem somewhere…

Do you have this at each startup (when it takes times )?

Or another message when startup takes time?

Grum999

A couple of seconds? Gosh noo. I browse the internet while I wait it to boot, Facebook and such.

I do see text on the splash art but I don’t recall off the top of my head what it says. I will check and measure the time.

Pinging @tiar about this problem.
Maybe she can have additional idea about what can be checked to understand from where the problem comes.

Grum999

Yeah…way more than a couple of seconds…probably 15+ seconds…will have to time it I guess…
…

yep 21 seconds.

That’s around ~6s on my side on 5.0.2
And around ~3s on a “resource optimized access” home made compiled version

Grum999

24.09s and it is building the resources yes.
it was faster than I was imagining it in my head.

@ericjpaint @EyeOdin @kacart could you please share the content of Help → Show Krita log for bug reports? It will be long so preferably on something like pastebin.com, it will show your paths (including username on your system) so if you want to make it more private, make sure to make it unlisted and to self-destruct in two weeks or so. Or change them with Find and Replace if you know how.

What I will be looking for is statement Database is up to date. It will show up only if the database is not being created from scratch. So absence of this text (in the first few lines of the log for every day) will mean that Krita does try to create it from scratch every time. (I hope I’ll remember to add another log line for the “creating database from scratch” event…)

For everyone with this issue, please also give me this information:

  • do you have plenty of resourcecache.sqlite.n~ (where n is a number) and if yes, how many (roughly)?
  • look at the creation date of resourcecache.sqlite, then close Krita and open again, and look at the creation date again, is it different (and set to just a moment ago)?
  • if you create your own custom tag, close Krita and reopen, does it still exist?
  • system, and the path to the resources (is it default or not) and if you’re on Windows, then if you use Windows Store package or some other (Steam or Epic Store or just from the website)
  • how many resources and tags do you have? I mean besides the default ones.
  • If you know how, it would be awesome if you could backup your resource folder and start Krita a few times with a newly created one, and see if it’s faster.

If it’s not the database recreating but just the database queries taking so long, we have a shimmer of hope in a form of this MR: Draft: Improve performance of query in KisTagResourceModel (!1302) · Merge requests · Graphics / Krita · GitLab - it makes quite an important query (which takes longer if you have plenty of resources and plenty of tags) even up to 4x faster. And I’m working on other performance improvements, too. But we gotta first check what is really going on here :slight_smile:

I’m not concerned about 20 sec startup, but will take a look at that log and see what it says…
…
here’s my most recent startup:

SESSION: 28 Jan 2022 06:32:50 -0700. Executing C:\Program Files\Krita (x64)\bin\krita.exe

Krita Version: 5.0.2, Qt version compiled: 5.12.12, loaded: 5.12.12. Process ID: 17772


28 Jan 2022 06:32:50 -0700: Style: fusion. Available styles: windowsvista, Windows, Fusion
28 Jan 2022 06:32:56 -0700: Database is up to date. Version: 0.0.15, created by Krita 5.0.0, at Thu Dec 23 13:57:38 2021
28 Jan 2022 06:33:01 -0700: Could not retrieve md5 for resourcepalettes/Pastel5x2.kpl
28 Jan 2022 06:33:02 -0700: Non-store package - creating updater
28 Jan 2022 06:33:15 -0700: CLOSING SESSION

SESSION: 28 Jan 2022 09:21:14 -0700. Executing C:\Program Files\Krita (x64)\bin\krita.exe

Krita Version: 5.0.2, Qt version compiled: 5.12.12, loaded: 5.12.12. Process ID: 15028


28 Jan 2022 09:21:14 -0700: Style: fusion. Available styles: windowsvista, Windows, Fusion
28 Jan 2022 09:21:17 -0700: Database is up to date. Version: 0.0.15, created by Krita 5.0.0, at Thu Dec 23 13:57:38 2021
28 Jan 2022 09:21:22 -0700: Could not retrieve md5 for resourcepalettes/Pastel5x2.kpl
28 Jan 2022 09:21:23 -0700: Non-store package - creating updater

KDE Neon fresh install, Krita 5.0.2 load 5-6 seconds :smiley:

link: SESSION: 28 Jan 2022 02:14:16 +0000. Executing C:\Program Files\Krita (x64)\bin\ - Pastebin.com

added information:

  • unknown
  • unknown
  • it maintains between sessions
  • I use the default paths. Window version. I install the version from the oficial web site
  • 27
  • I am not keen on that at the moment

I previously was using Ubuntu’s Krita 4.4.2, and then downloaded the 5.0.2 AppImage (x86-64) from krita.org. They seem to use different directories because none of my old brushes show up.

Anyways, there wasn’t much from the startup log: SESSION: 28 Jan 2022 18:26:02 -0800. Executing krita5Krita Version: 5.0.2, Q - Pastebin.com

It says “Database is up to date.” 1 second after starting, then spends 30+ seconds reading bundle files.

In stderr I also see a pile of “NOT COOL: Duplicate action name from xml data:” messages early in the startup.

Edit: I should point out that the logs show that the database was created several days ago. So it seems the database is not being re-created every time, but still spends a lot of time reading bundle files.