help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inheritance - why so slow?


From: Cosmin Calinescu
Subject: Re: Inheritance - why so slow?
Date: Tue, 12 Oct 2004 15:05:50 -0400
User-agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.6) Gecko/20040116

if visual C or whatever is fast is because probably dosen't compile correctly.
Wasn't that the comipler that couldn't handle multiple inheritance ?

Krzysztof Duleba wrote:
Paul Pluzhnikov wrote:


Nobody else finds this interesting?

No, not really.

Draw inheritance tree for the code you are generating (just do it
for N=3), and count how many classes A3 inherits from (directly
and indirectly). The compiler has to search them all.

Since that number grows exponentially (2**N - 1),


Tell me if I'm wrong, but there are only N classes, right? So the graph
has only O(N) veticles and O(N^2) edges. Where can you see a tree of
exponential size?


why are you surprized that you see an exponential slow-down?


I'd expect O(N^2) slow-down and Visual C++ seems to work his fast. Why
should g++ be that much slower?

Regards
Krzysztof Duleba






reply via email to

[Prev in Thread] Current Thread [Next in Thread]