<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Virtual inheritance overhead in g++</title>
	<link>https://codesynthesis.com/~boris/blog//2008/04/17/virtual-inheritance-overhead-gcc/</link>
	<description>Boris Kolpackov's blog about software</description>
	<pubDate>Wed, 22 Apr 2026 09:11:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>

	<item>
		<title>By: Robert 'Groby' Blum</title>
		<link>https://codesynthesis.com/~boris/blog//2008/04/17/virtual-inheritance-overhead-gcc/#comment-398</link>
		<author>Robert 'Groby' Blum</author>
		<pubDate>Fri, 18 Apr 2008 18:09:23 +0000</pubDate>
		<guid>https://codesynthesis.com/~boris/blog//2008/04/17/virtual-inheritance-overhead-gcc/#comment-398</guid>
		<description>@boris: Absolutely - I'd appreciate a quick e-mail when I can try this myself. I'm doing a bit of research into compilation speeds of C++, so I'd love to have sample cases,

@Cam: Even though it's virtual, it's still a diamond. derived_impl still can call either derived::foo() or base_impl::foo(). Yes, derived::foo() is abstract - but at every invokation of foo() the compiler needs to actually find out which one you meant.

I do think that memory usage and compile time are excessive, but I'm not surprised the second example is simpler. I'd love to see the gcc team's take on this....</description>
		<content:encoded><![CDATA[<p>@boris: Absolutely - I&#8217;d appreciate a quick e-mail when I can try this myself. I&#8217;m doing a bit of research into compilation speeds of C++, so I&#8217;d love to have sample cases,</p>
<p>@Cam: Even though it&#8217;s virtual, it&#8217;s still a diamond. derived_impl still can call either derived::foo() or base_impl::foo(). Yes, derived::foo() is abstract - but at every invokation of foo() the compiler needs to actually find out which one you meant.</p>
<p>I do think that memory usage and compile time are excessive, but I&#8217;m not surprised the second example is simpler. I&#8217;d love to see the gcc team&#8217;s take on this&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: boris</title>
		<link>https://codesynthesis.com/~boris/blog//2008/04/17/virtual-inheritance-overhead-gcc/#comment-395</link>
		<author>boris</author>
		<pubDate>Fri, 18 Apr 2008 10:07:21 +0000</pubDate>
		<guid>https://codesynthesis.com/~boris/blog//2008/04/17/virtual-inheritance-overhead-gcc/#comment-395</guid>
		<description>Robert, Paolo,

It will be hard to come up with a stand-alone test case since the generated code depends on the runtime library. But it is all open-source and the schema is publicly available so you will be able to reproduce this once the next version of XSD/e with support for delegation-based reuse is out. I can also provide makefiles, option files, etc. Let me know if you are interested.</description>
		<content:encoded><![CDATA[<p>Robert, Paolo,</p>
<p>It will be hard to come up with a stand-alone test case since the generated code depends on the runtime library. But it is all open-source and the schema is publicly available so you will be able to reproduce this once the next version of XSD/e with support for delegation-based reuse is out. I can also provide makefiles, option files, etc. Let me know if you are interested.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cam</title>
		<link>https://codesynthesis.com/~boris/blog//2008/04/17/virtual-inheritance-overhead-gcc/#comment-394</link>
		<author>Cam</author>
		<pubDate>Fri, 18 Apr 2008 04:43:49 +0000</pubDate>
		<guid>https://codesynthesis.com/~boris/blog//2008/04/17/virtual-inheritance-overhead-gcc/#comment-394</guid>
		<description>@Groby
Isn't the point of the first example using virtual inheritance because something inherits from a base class more than once (aka the dreaded diamond)?. Or am I missing something?</description>
		<content:encoded><![CDATA[<p>@Groby<br />
Isn&#8217;t the point of the first example using virtual inheritance because something inherits from a base class more than once (aka the dreaded diamond)?. Or am I missing something?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paolo Bonzini</title>
		<link>https://codesynthesis.com/~boris/blog//2008/04/17/virtual-inheritance-overhead-gcc/#comment-393</link>
		<author>Paolo Bonzini</author>
		<pubDate>Thu, 17 Apr 2008 19:07:57 +0000</pubDate>
		<guid>https://codesynthesis.com/~boris/blog//2008/04/17/virtual-inheritance-overhead-gcc/#comment-393</guid>
		<description>Can you report these two testcases to the GCC bugzilla (and CC me, bonzini@gnu.org on the testcases).  Chances are that the build times and memory usages can be improved a lot.</description>
		<content:encoded><![CDATA[<p>Can you report these two testcases to the GCC bugzilla (and CC me, <a href="mailto:bonzini@gnu.org">bonzini@gnu.org</a> on the testcases).  Chances are that the build times and memory usages can be improved a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert 'Groby' Blum</title>
		<link>https://codesynthesis.com/~boris/blog//2008/04/17/virtual-inheritance-overhead-gcc/#comment-387</link>
		<author>Robert 'Groby' Blum</author>
		<pubDate>Thu, 17 Apr 2008 17:59:52 +0000</pubDate>
		<guid>https://codesynthesis.com/~boris/blog//2008/04/17/virtual-inheritance-overhead-gcc/#comment-387</guid>
		<description>Hm. That has me curious to play with GCC to see what actually happens. One problem that I can spot right away in your original implementation is that derived_impl is derived *twice* from base. Once through derived, once through base_impl

That means whenever you call foo() on a derived_impl, gcc needs to disambiguate between base::foo() and base_impl::foo(). (Which is a tricky problem )

Your second solution does the disambiguation for the compiler - it specfies that a call to derived_impl can only use derived::foo, which will automatically forward to base_impl::foo

I'm surprised that the difference in memory usage and compile time is that big, though.

If you have a stripped sample project, I'd like to run it on various other compilers....</description>
		<content:encoded><![CDATA[<p>Hm. That has me curious to play with GCC to see what actually happens. One problem that I can spot right away in your original implementation is that derived_impl is derived *twice* from base. Once through derived, once through base_impl</p>
<p>That means whenever you call foo() on a derived_impl, gcc needs to disambiguate between base::foo() and base_impl::foo(). (Which is a tricky problem )</p>
<p>Your second solution does the disambiguation for the compiler - it specfies that a call to derived_impl can only use derived::foo, which will automatically forward to base_impl::foo</p>
<p>I&#8217;m surprised that the difference in memory usage and compile time is that big, though.</p>
<p>If you have a stripped sample project, I&#8217;d like to run it on various other compilers&#8230;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
