linuxmint / mintinstall

Software Manager
143 stars 100 forks source link

Speed up initialization by optimizing package sorting #412

Closed alexkuz closed 6 months ago

alexkuz commented 9 months ago

Calling pkginfo_is_installed on every package, especially in sorter function, turned out to be pretty expensive. The package sorting is optimized by getting installation info in batch (note that "internal" installer._apt and installer._flatpak modules are used - should it be a patch for mintcommon?)

Before:

Application.do_activate took 16899.680 ms

After:

Application.do_activate took 7158.331 ms
mtwebster commented 9 months ago

Nice - I've been wanting to look into the slow startup for a while. I know that sort for top-rated apps was heavy, maybe not worth what we get out of it.

Yeah we could probably do with an installer method for fetching installed refs just to avoid accessing _flatpak and _apt directly, with a pkg_type argument.

mtwebster commented 6 months ago

Merged: https://github.com/linuxmint/mintinstall/commit/fb666cf859c3706ecf3851c6d098ca5849136346

Thanks