Merge lp:~andersk/update-notifier/apt-check-speed into lp:update-notifier/ubuntu

Proposed by Anders Kaseorg
Status: Merged
Merged at revision: 821
Proposed branch: lp:~andersk/update-notifier/apt-check-speed
Merge into: lp:update-notifier/ubuntu
Diff against target: 31 lines (+1/-10)
1 file modified
data/apt_check.py (+1/-10)
To merge this branch: bzr merge lp:~andersk/update-notifier/apt-check-speed
Reviewer Review Type Date Requested Status
Ubuntu Core Development Team Pending
Review via email: mp+188555@code.launchpad.net

Description of the change

Speed up apt-check from 9 seconds to 1.9 seconds by removing ancient cruft.

To post a comment you must log in.
Revision history for this message
Brian Murray (brian-murray) wrote :

I believe you've removed a bit too much here as depcache.read_pinfile() would read /etc/apt/preferences or /etc/apt/preferences.d/.

Revision history for this message
Anders Kaseorg (andersk) wrote :

Those are already read by default (pkgCacheFile::Open → pkgCacheFile::BuildPolicy → ReadPinFile, ReadPinDir). There’s no need to read them again. I tested that my version still respects pins.

Revision history for this message
Brian Murray (brian-murray) wrote :

Got it, thanks for working on this.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/apt_check.py'
2--- data/apt_check.py 2012-10-16 13:45:38 +0000
3+++ data/apt_check.py 2013-10-01 11:17:52 +0000
4@@ -72,11 +72,6 @@
5 # FIXME: do a ionice here too?
6 os.nice(19)
7 apt_pkg.init()
8- # force apt to build its caches in memory for now to make sure
9- # that there is no race when the pkgcache file gets re-generated
10- #apt_pkg.config.set("debug::pkgcachegen","1")
11- apt_pkg.config.set("Dir::Cache::pkgcache","")
12- apt_pkg.config.set("Dir::Cache::srcpkgcache","")
13
14 def run(options=None):
15
16@@ -95,14 +90,10 @@
17 sys.exit(-1)
18 depcache = apt_pkg.DepCache(cache)
19
20- # read the pin files
21- depcache.read_pinfile()
22 # read the synaptic pins too
23 if os.path.exists(SYNAPTIC_PINFILE):
24 depcache.read_pinfile(SYNAPTIC_PINFILE)
25-
26- # init the depcache
27- depcache.init()
28+ depcache.init()
29
30 if depcache.broken_count > 0:
31 sys.stderr.write("E: "+ _("Error: BrokenCount > 0"))

Subscribers

People subscribed via source and target branches

to all changes: