This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

Re: [PATCH 3/8] Code cleanup: Split dwarf2_ranges_read to a callback


On Fri, 17 Feb 2017 02:19:06 +0100, Pedro Alves wrote:
> std::function is a lot of unnecessary overhead here.  Unless you
> manage to trigger to small-function optimization (which you won't here,
> the callbacks are too big), this is forcing a heap allocation inside
> std::function for every call to dwarf2_ranges_process.

These microoptimizations lead to the still broken fundamental data types and
algorithms of GDB, having to wait for minutes to hours to print an expression
(although usually it is not printable anyway).

perf would show the problem if it is really significant.  It would be less
significant with tcmalloc which GNU libc systems still do not use by default.


> Let's only use std::function for it's intended use-case of when the
> design calls for taking, or more usually, storing, a callable whose
> type is not knowable at compile type.

You are defining a new C++ specification here?  I have checked the code as
I wrote it is a perfect use of std::function<> according to the ISO C++11
specification.

Thanks you have noticed current GCC has missed-optimization in this case and
that it can be workarounded by a template as you have suggested.  It leads to
worse compilation diagnostics and we can hope this hack can be removed in the
future.  Still I agree this workaround of GCC is worth the performance gain.


Jan


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