lp://staging/~sjakthol/update-manager/fix-slow-calculation

Created by Sami Jaktholm and last modified
Get this branch:
bzr branch lp://staging/~sjakthol/update-manager/fix-slow-calculation
Only Sami Jaktholm can upload to this branch. If you are Sami Jaktholm please log in for upload directions.

Branch merges

Related bugs

Related blueprints

Branch information

Owner:
Sami Jaktholm
Project:
Software Updater
Status:
Merged

Recent revisions

2623. By Sami Jaktholm

Fix pyflakes and pep8 errors.

2622. By Sami Jaktholm

Use modulo instead of random() to determine if we should spin the loop.

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.

2620. By Michael Terry

Use correct variable in error message, fixing a crash (LP: #1142151)

2619. By Michael Terry

releasing version 1:0.185

2618. By Michael Terry

Look for to-be-updated application icons in app-install-data
(LP: #1145157)

2616. By Colin Watson

releasing version 1:0.184

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
This branch contains Public information 
Everyone can see this information.

Subscribers