Right now, the path completion for op mode translates to /bin/cli-shell-api listActiveNodes <path> | sed -e "s/'//g" && echo.
That's rarely a major performance problem, but:
- As long as we use CStore and its "directory tree as a config tree" approach, getting active nodes for op mode completion is nothing more than listing a directory under /opt/vyatta/config/active.
- cli-shell-api and CStore in general do a lot of things just to start up, and it's about four times slower than ls.
- The complete commands that needs to unquote node names takes three subprocess spawns instead of one.
We could use a simple directory listing instead of that call. Since the command is generated from XML definitions using a template, it's trivial to replace and will equally trivial to replace again when we implement a proper config daemon with in-memory config trees.
vyos@vyos# time /bin/cli-shell-api listActiveNodes service 'ntp' 'ssh' real 0m0.007s user 0m0.004s sys 0m0.003s [edit] vyos@vyos# time ls /opt/vyatta/config/active/service/ ntp ssh real 0m0.002s user 0m0.000s sys 0m0.002s