Package: apt Version: 0.6.46.3 Severity: important Tags: patch
The "Building dependency tree..." takes an extremely long time on may arm machine. Firther investigation shows this is spending most of its time in gettimeofday(), which is quite a slow function on this machine. apt calls OpProgress::CheckChange very frequently during this process. Estimates from a faster machine indicate it is called many thousands of times. Consider the case where we have just completed the first 1% progress. CheckChange is called, and the value to be displayed is different, so we call gettimeofday to figure out how log ago that was. It wasn't very long (< 0.7 sec), so we return false. Note that LastPercent is not modified. After the next extremely small piece of work we the same is still true. We continue making extremely slow progress, spending most of our time in gettimeofday. After 0.7 seconds has passed we return true and update LastPercent. Annother 0.9%ish occurs quickly because CheckChange returns immediately, until we get to 3% complete, at which point we start calling gettimeofday again. Thus the whole process takes well over a minute instead of a few seconds. On a other machines the same occurs, but gettimeofday is sufficiently fast that calling it 25 thousand times isn't so noticable. The patch below modifies CheckChange to only try and update update when the progress crosses a percentage boundary, rather than when 1% progress since the last update. Only updating when crossing a boundry means that under extreme circumstances the displayed value may lag behind the actual state by one update. Under normal curcumstances (slow or steady progress) the displayed value will be just as accurate. It's only a progress bar :-) On my amd64 machine the patch reduces the time taken to run "apt-get install apt" from 0.33 sec to 0.27 sec. On my slower arm machine it goes from 55 sec to 28 sec. Paul diff -ur apt/apt-pkg/contrib/progress.cc apt/apt-pkg/contrib/progress.cc --- apt-clean/apt-pkg/contrib/progress.cc 2006-03-02 14:27:13 +++ apt-0.6.46.3/apt-pkg/contrib/progress.cc 2006-11-13 02:20:39 @@ -116,6 +116,8 @@ if ((int)LastPercent == (int)Percent) return false; + LastPercent = Percent; + if (Interval == 0) return false; @@ -126,6 +128,5 @@ if (Diff < Interval) return false; LastTime = Now; - LastPercent = Percent; return true; } -- Package-specific info: -- (no /etc/apt/preferences present) -- -- (/etc/apt/sources.list present, but not submitted) -- -- System Information: Debian Release: 4.0 APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.16-2-xen-amd64-k8 Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1) Versions of packages apt depends on: ii debian-archive-keyring 2006.01.18 GnuPG archive keys of the Debian a ii libc6 2.3.6.ds1-7 GNU C Library: Shared libraries ii libgcc1 1:4.1.1-19 GCC support library ii libstdc++6 4.1.1-19 The GNU Standard C++ Library v3 apt recommends no packages. -- no debconf information -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]