lp://staging/~sjakthol/update-manager/fix-slow-calculation
- Get this branch:
- bzr branch lp://staging/~sjakthol/update-manager/fix-slow-calculation
Branch merges
- Michael Terry: Approve
-
Diff: 286 lines (+127/-68)1 file modifiedUpdateManager/Core/UpdateList.py (+127/-68)
Related bugs
Bug #1167277: Unresponsive for a long time after checking for updates | Medium | Fix Released |
Related blueprints
Branch information
Recent revisions
- 2621. By Sami Jaktholm
-
Implement various solutions to speed up the group calculation.
1. Create a set of recursive dependencies for each app group.
The previous implementation traversed the dependency tree until a dependency
was found (if there was one) and repeated the same procedure for every
package. Software Updater spent most of it's time doing the same thing again
and again.This branch traverses the dependency tree once and stores the data in a set
(for automatic deduplication). The cache is initiated during first call to
is_dependency and expanded with new items as new packages are added to the
group. Once the cache is created, it's just a matter of simple "pkg in deps"
test to see if the package is a dependency of an application in that group.2. Don't glob /usr/share/
app-install/ desktop/ for every package.
Instead, glob the directory once and save the URIs of desktop files that
have an upgradeable package associated with them. These URIs are later added
to the list of desktop_files in _get_application_for_package. 3. Cache package dependencies.
When the package dependencies are calculated for the first time, the data is
saved to a dict shared between groups. The cached data is used in the
consequent queries for that same package (in other app groups). It's faster
to fetch a list of strings from a dict than it's to iterate Dependency
objects to get the package names.4. Speed up _file_is_
application.
Make _file_is_application to return false right away if the file name
doesn't have a .desktop extension.The old version was spending a lot of time checking whether file was located
in a known application directory and then returned false because it didn't
have a .desktop extension. As this is called for every file in every
upgradeable package, the performance impact was substantial.5. Don't spin main loop on every call to _add_deps.
_add_deps is invoked thousands of times in a few seconds and the UI
doesn't need to be updated every time. As _add_deps doesn't take ages to
complete it's enough to spin the loop once in a while. That'll be enough to
keep the UI alive.6. Remove useless sorting by source package in _make_groups.
The list of packages was first sorted by source but that information was
never used. The useless nested loops were removed. - 2615. By Colin Watson
-
Allow removals with only Conflicts+Replaces; while policy 7.6.2 quotes
Provides in an example, it's clear that Conflicts+Replaces alone should
be sufficient to indicate that the target package may be removed. - 2614. By Michael Terry
-
Don't temporarily freeze when calculating which updates are available.
LP: #1137996
Branch metadata
- Branch format:
- Branch format 7
- Repository format:
- Bazaar repository format 2a (needs bzr 1.16 or later)
- Stacked on:
- lp://staging/update-manager