This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: Compiling c++ template is very slow.


On 03/09/2018 06:51 AM, Richard Biener wrote:
On Fri, Mar 9, 2018 at 11:32 AM, Richard Biener
<richard.guenther@gmail.com> wrote:

callgrind shows that propagate_binfo_offsets recursing
to self very many times is likely the issue.  Your templates
build a very deep inheritance chain and it seems that
the binfo offset propagation ends up being exponential here.

I would have expected that any bases have already correct
offsets so we don't need the recursion to bases of bases?

Ah, so in this case we have offset of 1 because sizeof is
always nonzero.  So the issue might just be that
BINFO_OFFSET is not relative to the parent?

Correct, it's relative to the complete object.

doens't improve things.  We call this functions millions of times
creating millions of INTEGER_CSTs.  Can BINFO_OFFSET be
non-constant?

No. (if it's a vbase, it shows the offset in the complete object, IIRC, and there's other data to let code generation know some vtable inspection is needed when the dynamic type is unknown).

nathan

--
Nathan Sidwell


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