Merge lp:~fahlgren/command-not-found/speedup into lp:~command-not-found-developers/command-not-found/trunk

Proposed by Daniel Fahlgren
Status: Merged
Merged at revision: 137
Proposed branch: lp:~fahlgren/command-not-found/speedup
Merge into: lp:~command-not-found-developers/command-not-found/trunk
Diff against target: 15 lines (+4/-1)
1 file modified
CommandNotFound/CommandNotFound.py (+4/-1)
To merge this branch: bzr merge lp:~fahlgren/command-not-found/speedup
Reviewer Review Type Date Requested Status
Zygmunt Krynicki Approve
Review via email: mp+70939@code.launchpad.net

This proposal supersedes a proposal from 2011-08-09.

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote : Posted in a previous version of this proposal

Could you please add a note that explains what this argument does and call it by name (...withMatcher=False) and then it can go in.

review: Needs Fixing
Revision history for this message
Michael Vogt (mvo) wrote : Posted in a previous version of this proposal

Thanks for your branch! I'm curious what kind of speedup we get with it, are there any numbers for this :) ?

Revision history for this message
Daniel Fahlgren (fahlgren) wrote :

To get some better statistics did I run 100 calls to command-not-found for different commands.

For the missing command "cab"
On my i5@2.30GHz with a SSD disk is the execution time dropped from 12.362s to 6.888s.
On my Atom 330 with a 2.5" mechanical disk is the execution time dropped from 1m12.961s to 38.413s

For the missing command "emacx"
On my i5@2.30GHz is it dropped from 12.749s to 6.933s
Om my Atom 330 is it dropped from 1m13.722s to 39.194s

For the missing command "empathy-debuggert"
On my i5@2.30GHz is it dropped from 13.678s to 7.873s
Om my Atom 330 is it dropped from 1m20.910s to 46.375s

These numbers does include the time for bash to iterate 100 times and do the calls. The output was discarded to /dev/null not to interfere with the results.

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

This looks good to me. Unless mvo disagrees we could merge this now.

review: Approve
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

out of curiosity (I work on benchmarks and validation now :-) I ran this on my core i7 laptop with conventional hard drive running natty I get those results:

Before applying the patch:

time for i in `seq 1 100`; do ./command-not-found emacx >/dev/null 2>&1 ; done

real 0m34.707s
user 0m28.990s
sys 0m5.080s

After applying the patch:

time for i in `seq 1 100`; do ./command-not-found emacx >/dev/null 2>&1 ; done

real 0m15.366s
user 0m10.860s
sys 0m3.940s

Essentially 226% faster, wow :-)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CommandNotFound/CommandNotFound.py'
2--- CommandNotFound/CommandNotFound.py 2010-05-28 19:17:40 +0000
3+++ CommandNotFound/CommandNotFound.py 2011-08-09 18:14:29 +0000
4@@ -129,7 +129,10 @@
5 except (SystemError, ImportError), e:
6 return []
7 sources_list = set([])
8- for source in SourcesList():
9+ # The matcher parses info files from
10+ # /usr/share/python-apt/templates/
11+ # But we don't use the calculated data, skip it
12+ for source in SourcesList(withMatcher=False):
13 if not source.disabled and not source.invalid:
14 for component in source.comps:
15 sources_list.add(component)

Subscribers

People subscribed via source and target branches