[PATCH] Make completions almost instantaneous

Andrew Cagney ac131313@cygnus.com
Fri Mar 30 15:50:00 GMT 2001


Daniel Berlin wrote:

> -   /* Clip any symbol names that we've already considered.  (This is a
> -      time optimization)  */
> -
> -   for (i = 0; i < return_val_index; ++i)
> -     {
> -       if (STREQ (symname, return_val[i]))
> -       {
> -         return;
> -       }
> -     }
> -

It probably should have said ``space optimization''.  I'd take a guess
that this dates back to a time when readline didn't remove duplicates
and when people were more worried about memory.

I suspect that someone might eventually re-tweek the code so that it
does an O(log(n)) sorted insertion and that way eliminates duplicates. 
However, given that Eli (i.e. dos) is happy with change, I don't see
that happening soon.

As Elena said, nice catch.

	Andrew



More information about the Gdb-patches mailing list