[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#674143: lsb-release is very slow



Package: lsb-release
Version: 4.1+Debian4
Severity: normal
Tags: patch

Dear Maintainer,

To reproduce the problem, simply run:

$ /usr/bin/time /usr/bin/lsb_release -sd
Debian GNU/ testing (wheezy)
1.84user 0.05system 0:01.91elapsed 99%CPU (0avgtext+0avgdata 137200maxresident)k
0inputs+0outputs (0major+14470minor)pagefaults 0swaps

This is on a hot cache with a 2.6GHz Core 2. On a cold cache this can take upi
to 4 seconds. What makes it so slow is that it systematically calls
'apt-cache policy':

$ LANG=C /usr/bin/time apt-cache policy >/dev/null
1.72user 0.07system 0:01.80elapsed 99%CPU (0avgtext+0avgdata 137200maxresident)k
0inputs+0outputs (0major+11680minor)pagefaults 0swaps

The patch below works around this issue for non-testing Debian versions by not
calling guess_release_from_apt() if we don't need to. This gets the execution
time down to 0.03 seconds. Unfortunately this does not help me since I'm
running Debian Testing :-(

--- /usr/share/pyshared/lsb_release.py.orig	2012-05-23 11:59:21.909934400 +0200
+++ /usr/share/pyshared/lsb_release.py	2012-05-23 12:12:59.281968570 +0200
@@ -270,8 +270,10 @@ def guess_debian_release():
     # This is slightly faster and less error prone in case the user
     # has an entry in his /etc/apt/sources.list but has not actually
     # upgraded the system.
-    rinfo = guess_release_from_apt()
-    if rinfo and not distinfo.get('CODENAME'):
+    rinfo = None
+    if not distinfo.get('CODENAME'):
+        rinfo = guess_release_from_apt()
+    if rinfo:
         release = rinfo.get('version')
 
         # Special case Debian-Ports as their Release file has 'version': '1.0'


-- Package-specific info:
lsb_release output
-*- -*- -*- -*- -*-
LSB Version:	core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch:core-4.1-amd64:core-4.1-noarch:security-4.0-amd64:security-4.0-noarch:security-4.1-amd64:security-4.1-noarch
Distributor ID:	Debian
Description:	Debian GNU/Linux testing (wheezy)
Release:	testing
Codename:	wheezy
-*- -*- -*- -*- -*-
    Apt policy
-*- -*- -*- -*- -*-
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 http://dl.google.com/linux/earth/deb/ stable/main amd64 Packages
     release v=1.0,o=Google, Inc.,a=stable,n=stable,l=Google,c=main
     origin dl.google.com
 500 http://dl.google.com/linux/chrome/deb/ stable/main amd64 Packages
     release v=1.0,o=Google, Inc.,a=stable,n=stable,l=Google,c=main
     origin dl.google.com
 500 http://mirror.home-dn.net/debian-multimedia/ testing/main amd64 Packages
     release v=None,o=Unofficial Multimedia Packages,a=testing,n=wheezy,l=Unofficial Multimedia Packages,c=main
     origin mirror.home-dn.net
 500 http://ftp.fr.debian.org/debian/ testing/non-free Translation-en
 500 http://ftp.fr.debian.org/debian/ testing/main Translation-fr
 500 http://ftp.fr.debian.org/debian/ testing/main Translation-en
 500 http://ftp.fr.debian.org/debian/ testing/contrib Translation-en
 500 http://ftp.fr.debian.org/debian/ testing/non-free amd64 Packages
     release o=Debian,a=testing,n=wheezy,l=Debian,c=non-free
     origin ftp.fr.debian.org
 500 http://ftp.fr.debian.org/debian/ testing/contrib amd64 Packages
     release o=Debian,a=testing,n=wheezy,l=Debian,c=contrib
     origin ftp.fr.debian.org
 500 http://ftp.fr.debian.org/debian/ testing/main amd64 Packages
     release o=Debian,a=testing,n=wheezy,l=Debian,c=main
     origin ftp.fr.debian.org
 500 http://security.debian.org/ stable/updates/non-free amd64 Packages
     release v=6.0,o=Debian,a=stable,n=squeeze,l=Debian-Security,c=non-free
     origin security.debian.org
 500 http://security.debian.org/ stable/updates/contrib amd64 Packages
     release v=6.0,o=Debian,a=stable,n=squeeze,l=Debian-Security,c=contrib
     origin security.debian.org
 500 http://security.debian.org/ stable/updates/main amd64 Packages
     release v=6.0,o=Debian,a=stable,n=squeeze,l=Debian-Security,c=main
     origin security.debian.org
 500 http://ftp.fr.debian.org/debian/ stable/main Translation-fr
 500 http://ftp.fr.debian.org/debian/ stable/non-free amd64 Packages
     release v=6.0.5,o=Debian,a=stable,n=squeeze,l=Debian,c=non-free
     origin ftp.fr.debian.org
 500 http://ftp.fr.debian.org/debian/ stable/contrib amd64 Packages
     release v=6.0.5,o=Debian,a=stable,n=squeeze,l=Debian,c=contrib
     origin ftp.fr.debian.org
 500 http://ftp.fr.debian.org/debian/ stable/main amd64 Packages
     release v=6.0.5,o=Debian,a=stable,n=squeeze,l=Debian,c=main
     origin ftp.fr.debian.org
Pinned packages:
     xserver-xorg-input-acecad -> (not found)
     xserver-xorg-driver-sisusb -> (not found)
     xserver-xorg-driver-s3 -> (not found)
     xserver-xorg-video-i740 -> (not found)
     xserver-xorg-video-i810 -> (not found)
     xserver-xorg-video-ivtv-dbg -> (not found)
     xserver-xorg-driver-nv -> (not found)
     xserver-xorg-video-all -> (not found)
     xserver-xorg-video-suntcx -> (not found)
     xserver-xorg-video-apm -> (not found)
     xserver-xorg-input-evtouch -> (not found)
     xserver-xorg-video-ark -> (not found)
     xserver-xorg-video-ati -> (not found)
     xserver-xfbdev -> (not found)
     xserver-xorg-driver-dummy -> (not found)
     xserver-xorg-driver-vesa -> (not found)
     xserver-xorg-driver-cirrus -> (not found)
     xserver-xorg-video-radeonhd -> (not found)
     xserver-xfree86 -> (not found)
     xserver-xorg-video-openchrome -> (not found)
     xserver-xorg-input-multitouch -> (not found)
     xserver-xorg-video-newport -> (not found)
     xserver-xorg-video-radeon-dbg -> (not found)
     xserver-xorg-driver-all -> (not found)
     xserver-xorg-video-s3virge -> (not found)
     xserver-xorg-video-v4l -> (not found)
     xserver-xorg-driver-apm -> (not found)
     xserver-xorg-driver-ark -> (not found)
     xserver-xorg-video-mga -> (not found)
     xserver-xorg-video-radeonhd-dbg -> (not found)
     xserver-xorg-video-chips -> (not found)
     xserver-xorg-core -> (not found)
     xserver-xorg-input-mutouch -> (not found)
     xserver-xorg-video-mach64 -> (not found)
     xserver-xorg-video-msm -> (not found)
     xserver-xorg-video-nsc -> (not found)
     xserver-common -> (not found)
     xserver-xorg-video-geode -> (not found)
     xserver-xorg-video-r128-dbg -> (not found)
     xserver-xorg-video-trident -> (not found)
     xserver-xorg-video-i810-modesetting -> (not found)
     xserver-xorg-video-ati-dbg -> (not found)
     xserver-xorg-video-tga -> (not found)
     xserver-xorg-video-sis -> (not found)
     xserver-xorg-video-qxl -> (not found)
     xserver-xorg-video -> (not found)
     xserver-xorg-video-2 -> (not found)
     xserver-xorg-video-4 -> (not found)
     xserver-xorg-video-5 -> (not found)
     xserver-xorg-video-6 -> (not found)
     xserver-xorg-video-vga -> (not found)
     xserver-xorg-driver-mga -> (not found)
     xserver-xorg-video-via -> (not found)
     xserver-xorg-video-cyrix -> (not found)
     xserver-xorg-video-dummy -> (not found)
     xserver-xorg-video-1.0 -> (not found)
     xserver-xorg-video-1.9 -> (not found)
     xserver-xorg-video-siliconmotion -> (not found)
     xserver-xorg-input-vmmouse -> (not found)
     xserver-xorg-video-savage -> (not found)
     xserver-xorg-core-no-multiarch -> (not found)
     xserver-xorg-driver-tga -> (not found)
     xserver-xorg-driver-sis -> (not found)
     xserver-xorg-video-tdfx -> (not found)
     xserver-xorg-video-openchrome-dbg -> (not found)
     xserver-xorg-driver-glint -> (not found)
     xserver-xorg-video-qxl-dbg -> (not found)
     xserver-xorg-video-imstt -> (not found)
     xserver-xorg-input-2 -> (not found)
     xserver-xorg-input-4 -> (not found)
     xserver-xorg-driver-fbdev -> (not found)
     xserver-xorg-input-7 -> (not found)
     xserver-xorg-video-msm-dbg -> (not found)
     xserver-xorg-video-nvidia -> (not found)
     xserver-xorg-input-elographics -> (not found)
     xserver-xorg-video-intel -> (not found)
     xserver-xorg-driver-rendition -> (not found)
     xserver-xorg-input-all -> (not found)
     xserver-xorg-video-vmware -> (not found)
     xserver-xorg-video-r128 -> (not found)
     xserver-xorg-video-glamo -> (not found)
     xserver-xorg-input-evdev -> (not found)
     xserver-xorg-driver-i128 -> (not found)
     xserver-xorg-video-vesa -> (not found)
     xserver-xorg-input-joystick-dev -> (not found)
     xserver-xorg-driver-siliconmotion -> (not found)
     xserver-xorg-video-suncg14 -> (not found)
     xserver-xorg-input-kbd -> (not found)
     xserver-xorg-driver-s3virge -> (not found)
     xserver-xorg-driver-savage -> (not found)
     xserver-xorg-video-glide -> (not found)
     xserver-xorg-driver-neomagic -> (not found)
     xserver-xorg-driver-i740 -> (not found)
     xserver-xorg-driver-i810 -> (not found)
     xserver-xorg-video-s3 -> (not found)
     xserver-xorg -> (not found)
     xserver-xorg-video-glint -> (not found)
     xserver-xorg-dev -> (not found)
     xserver-xorg-video-nvidia-any -> (not found)
     xserver-xorg-input-void -> (not found)
     xserver-xorg-video-nv -> (not found)
     xserver-xorg-driver-trident -> (not found)
     xserver-xorg-driver-tseng -> (not found)
     xserver-xorg-video-voodoo -> (not found)
     xserver-xorg-video-fbdev -> (not found)
     xserver-xorg-input-wacom -> (not found)
     xserver-xorg-video-nouveau -> (not found)
     xserver-xorg-video-intel-modesetting -> (not found)
     xserver-xorg-input-aiptek -> (not found)
     xserver-xorg-input-penmount -> (not found)
     xserver-xorg-video-nouveau-dbg -> (not found)
     xserver-xorg-video-neomagic -> (not found)
     xserver-xorg-driver-vmware -> (not found)
     xserver-xephyr -> (not found)
     xserver-xorg-input-mouse -> (not found)
     xserver-xorg-input-2.1 -> (not found)
     xserver-xorg-core-dbg -> (not found)
     xserver-xorg-input-mtrack -> (not found)
     xserver-xorg-input-synaptics-dev -> (not found)
     xserver-xorg-video-mach64-dbg -> (not found)
     xserver-xorg-video-sisusb -> (not found)
     xserver-xorg-video-riva128 -> (not found)
     xserver-xspice -> (not found)
     xserver-xorg-video-suncg3 -> (not found)
     xserver-xorg-video-suncg6 -> (not found)
     xserver-xorg-driver-voodoo -> (not found)
     xserver-xorg-video-tseng -> (not found)
     xserver-xorg-video-geode-dbg -> (not found)
     xserver-xorg-video-radeon -> (not found)
     xserver-xorg-video-sunbw2 -> (not found)
     xserver-xorg-video-cirrus -> (not found)
     xserver-xorg-input -> (not found)
     xserver-xorg-video-omapfb -> (not found)
     xserver-xorg-video-sunffb -> (not found)
     xserver-xorg-video-intel-dbg -> (not found)
     xserver-xorg-input-joystick -> (not found)
     xserver-xorg-input-evdev-dev -> (not found)
     xserver-xorg-input-tslib -> (not found)
     xserver-xorg-video-omap3 -> (not found)
     xserver-xorg-driver-tdfx -> (not found)
     xserver-xorg-input-synaptics -> (not found)
     xserver-xorg-video-rendition -> (not found)
     xserver-xorg-video-i128 -> (not found)
     xserver-xorg-driver-chips -> (not found)
     xserver-xorg-video-sunleo -> (not found)
     xserver-xorg-video-ivtv -> (not found)
-*- -*- -*- -*- -*-
   sources.list
-*- -*- -*- -*- -*-
deb http://ftp.fr.debian.org/debian stable main contrib non-free
deb http://security.debian.org/ stable/updates main contrib non-free
deb-src http://ftp.fr.debian.org/debian stable main contrib non-free
deb-src http://security.debian.org/ stable/updates main contrib non-free
deb http://ftp.fr.debian.org/debian testing main contrib non-free
deb-src http://ftp.fr.debian.org/debian testing main contrib non-free
deb http://mirror.home-dn.net/debian-multimedia testing main
deb-src http://mirror.home-dn.net/debian-multimedia testing main
-*- -*- -*- -*- -*-
 /etc/lsb_release
-*- -*- -*- -*- -*-
- none

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages lsb-release depends on:
ii  python     2.7.2-10
ii  python2.6  2.6.7-4
ii  python2.7  2.7.3~rc2-2.1

Versions of packages lsb-release recommends:
ii  apt  0.9.3

Versions of packages lsb-release suggests:
pn  lsb  <none>

-- no debconf information

-- debsums errors found:
debsums: changed file /usr/share/pyshared/lsb_release.py (from lsb-release package)



Reply to: