On 16/11/06, Karl Hasselström <kha@xxxxxxxxxxx> wrote:
On 2006-11-16 14:21:27 +0000, Catalin Marinas wrote: > Thanks for the patch. I modified it slightly to automatically > generate the options for other commands as well (by invoking "stg > help <command>" and it doesn't seem to be slow). I'll try to push it > tonight. Hmm. I'll have to try it, but I was half planning to hard-code the list of subcommands instead of calling "stg help" since it causes a tangible delay. On the machines I've tried, it easily takes 0.2 seconds to run "stg help" (with hot caches; with cold caches, it's _really_ bad), and that's bad for interactive behavior.
Indeed, stg help takes over 200ms on my machine as well, with hot caches but this is mainly because it imports all the stgit.commands.* modules in order to read the short description. The 'stg help <command>' takes around 90ms on my machine since it only imports one module (I actually reduced it to 85ms by minimizing the imports even further). I could actually hard-code the commands only in the script. At the moment I removed the _stg_* functions and added some common _stg_all_patches() to avoid duplicating the code (see attached). -- Catalin
Attachment:
stgit-completion.bash
Description: Binary data