[Bug 598282] Re: command-not-found slow for its task

rgrig 598282 at bugs.launchpad.net
Fri Jul 22 00:53:03 UTC 2011


See attached. Try
  tar xaf pkghint.tar.bz2
  cd pkghint
  ./makedb.sh
  make

Here are some times on my computer:

rg at rqgm:pkghint$ time /usr/lib/command-not-found foobar
foobar: command not found
real	0m0.204s
user	0m0.168s
sys	0m0.032s

rg at rqgm:pkghint$ time ./pkghint foobar
foobar: command not found
real	0m0.017s
user	0m0.004s
sys	0m0.004s

rg at rqgm:not-found$ time /usr/lib/command-not-found lesx
No command 'lesx' found, did you mean:
 Command 'les' from package 'atm-tools' (universe)
 Command 'lex' from package 'flex' (main)
 Command 'lex' from package 'flex-old' (universe)
 Command 'less' from package 'less' (main)
lesx: command not found
real	0m0.202s
user	0m0.168s
sys	0m0.032s

rg at rqgm:not-found$ time ./pkghint lesx
No command 'lesx' found. Did you mean
  command 'less' from package 'less' (main)
  command 'lex' from package 'flex' (main)
  command 'lex' from package 'flex-old' (universe)
real	0m0.018s
user	0m0.004s
sys	0m0.004s


Feel free to reformat the code, but please don't make it slow ;)


** Attachment added: "pkghint.tar.bz2"
   https://bugs.launchpad.net/ubuntu/+source/command-not-found/+bug/598282/+attachment/2224598/+files/pkghint.tar.bz2

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to command-not-found in Ubuntu.
https://bugs.launchpad.net/bugs/598282

Title:
  command-not-found slow for its task

Status in “command-not-found” package in Ubuntu:
  Confirmed

Bug description:
  Binary package hint: command-not-found

  Considering command-not-found has a relatively simple job. It seems
  that it is horribly over-engineered for its task. And as such, we have
  runtimes such as this:

  
  $ time sl
  The program 'sl' is currently not installed.  You can install it by typing:
  sudo apt-get install sl

  real	0m1.715s
  user	0m0.680s
  sys	0m0.228s

  
  $ time sl
  The program 'sl' is currently not installed.  You can install it by typing:
  sudo apt-get install sl

  real	0m0.759s
  user	0m0.592s
  sys	0m0.116s


  
  A little over a year ago I wrote a replacement script, that I've numerously lost, found, updated and forgotten about. It is about 250 LOC, and kept with one thing in mind, KISS. What surprises me most though is not the simplicity in comparison, but that it is 14x faster at executing it's job.
  That script can be found here: http://ubuntuforums.org/showpost.php?p=7116396&postcount=1
  And this is how well it runs in comparison.

  
  $ time sl
  The program 'sl' is currently not installed.  You can install it by typing:
  sudo apt-get install sl

  real	0m0.079s
  user	0m0.036s
  sys	0m0.016s

  
  $ time sl
  The program 'sl' is currently not installed.  You can install it by typing:
  sudo apt-get install sl

  real	0m0.062s
  user	0m0.044s
  sys	0m0.016s

  
  You would be forgiven in thinking I used a compiled application to get such low times, but it is not, I tell you that now.

  So the ultimate question is, why punish users? I think some act needs
  to be gotten together to clamp down on the speed demons in this
  application. As IMO, it is in an unacceptable state.

  Regards

  ProblemType: Bug
  DistroRelease: Ubuntu 10.04
  Package: command-not-found 0.2.40ubuntu5
  ProcVersionSignature: Ubuntu 2.6.32-22.36-generic 2.6.32.11+drm33.2
  Uname: Linux 2.6.32-22-generic i686
  Architecture: i386
  Date: Thu Jun 24 22:33:33 2010
  PackageArchitecture: all
  ProcEnviron:
   LANG=en_GB.utf8
   SHELL=/bin/bash
  SourcePackage: command-not-found

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/command-not-found/+bug/598282/+subscriptions




More information about the foundations-bugs mailing list