This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH] Make completions almost instantaneous




On Fri, 30 Mar 2001, Eli Zaretskii wrote:

> > Date: Fri, 30 Mar 2001 04:09:08 -0500 (EST)
> > From: Daniel Berlin <dberlin@redhat.com>
> >
> > All this patch does is remove code.
> >
> > Remember kids, premature optimization is the root of all evil.
>
> I tried this patch, and all I can say is WOW!  "b TAB" while debugging
> Emacs (6.6K symbols) used to take 15 seconds, now it takes 2; the same
> while debugging GDB (10K symbols) used to take 30 seconds, now it
> takes 3.

Sounds about right.  It turned completion_list_add_symbol from O(n * m)
(m is the max of the length string we are trying to add, and the string we
are  comparing it to. n is the number of things on the completion list) to
O(1). Completion list addition is called n times.

That really was murder before.
 >
> Thanks!  I was always annoyed by this, but never had time to dig into
> it.
>
I can't even count the number of gdb's i've killed off because i got tired
of waiting for completion to come up.

The best part is that it was commented as a time optimization. It's
obvious the person who added it only completely small lists. It's
absolute murder otherwise.

> > Since it's unclear to me whether this is an obvious fix, i'll wait for
> > approval from Elena or Jim.
>
> Yes, please, please, pretty please, approve this!
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]