This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH RFC: Patches to speed up the demangler
Daniel Jacobowitz <drow@mvista.com> writes:
> > Well, one approach would be to write a version of the demangler which
> > just returns the base name. It should return the name as a pointer
> > into the argument plus a length, to avoid any time spent allocating
> > memory or even just copying characters around.
>
> That would work for foo, but not for foo::bar; GDB can handle that
> without debugging information. Crudely, but well enough to be useful.
Hmmm, why wouldn't it work for foo::bar? The base name of that would
be returned as bar. A breakpoint on foo::bar would look for every
symbol with a base name of bar.
> Once that issue's been addressed, it sounds like the same thing as
> DMGL_PARAMS.
Except that with the current interface you are still paying for memory
allocation and string copying. These are relatively inexpensive, but
over the whole symbol table it obviously adds up.
> I just verified that GDB does currently demangle
> functions at startup using DMGL_PARAMS - dubiously useful - so that
> might be the best point of attack.
Yes, that seems like a fairly simple optimization, although I think it
may only save you around 25% based on some timings I did a few weeks
ago.
Ian