On Fri, 2009-11-20 at 13:08 -0700, David Brownell wrote:
> On Friday 20 November 2009, Zachary T Welch wrote:
> > Use insertion sort to the command link lists.  The only practical effect
> > of this is to order the output of the new 'help' command.
> 
> O(really)?  O(n) != O(1).  ;)
> 
> Not that it can matter so long as we have sane numbers
> of commands.

Heh, almost a great point except it already used an O(n) algorithm, as
it was appending to the end of the list prior to this change.  Now, we
also do a strcmp at each step and then decide to pre- or post- append.
Since it's at registration time, any extra cost will be almost moot.

With a proper command hierarchy, that n should always be a small number.
The command was forward-designed to allow us to restructure commands to
provide sane numbers of commands, grouping commands with logically
similar commands.  This is somewhat ambitious, but it can be done
piecemeal as we march toward the final 1.0 command syntax.

I have started to look at natively implementing the "unknown" command,
so it does that job right for more than 2 levels of command nesting.

Cheers,

Zach

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to