<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Double Dispatch &#8211; RTTI vs. Pure Vtable</title>
	<atom:link href="http://www.somethingorothersoft.com/2010/02/02/double-dispatch-rtti-vs-pure-vtable/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.somethingorothersoft.com/2010/02/02/double-dispatch-rtti-vs-pure-vtable/</link>
	<description>About Software Development And Other Stuff By Igor Zevaka</description>
	<lastBuildDate>Wed, 28 Jul 2010 12:50:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: igor</title>
		<link>http://www.somethingorothersoft.com/2010/02/02/double-dispatch-rtti-vs-pure-vtable/comment-page-1/#comment-256</link>
		<dc:creator>igor</dc:creator>
		<pubDate>Tue, 02 Feb 2010 11:58:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.somethingorothersoft.com/?p=235#comment-256</guid>
		<description>&lt;p&gt;I tried Debug with run time checks turned off and that causes the vtable version to be twice faster than RTTI version.&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;&lt;code&gt;No RTTI - 717 milleseconds.
With RTTI - 1373 milleseconds.(-91.49% faster)
&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;With /RTCs (/RTCu has no effect) the results are as follows:&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;&lt;code&gt;No RTTI - 1903 milleseconds.
With RTTI - 2106 milleseconds.(10.67% faster)
&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;So I guess this means that &lt;code&gt;dynamic_cast&lt;/code&gt; requires less stack frame checks than vtable lookup.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I tried Debug with run time checks turned off and that causes the vtable version to be twice faster than RTTI version.</p>

<p><pre><code>No RTTI - 717 milleseconds.
With RTTI - 1373 milleseconds.(-91.49% faster)
</code></pre></p>

<p>With /RTCs (/RTCu has no effect) the results are as follows:</p>

<p><pre><code>No RTTI - 1903 milleseconds.
With RTTI - 2106 milleseconds.(10.67% faster)
</code></pre></p>

<p>So I guess this means that <code>dynamic_cast</code> requires less stack frame checks than vtable lookup.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: igor</title>
		<link>http://www.somethingorothersoft.com/2010/02/02/double-dispatch-rtti-vs-pure-vtable/comment-page-1/#comment-254</link>
		<dc:creator>igor</dc:creator>
		<pubDate>Tue, 02 Feb 2010 01:56:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.somethingorothersoft.com/?p=235#comment-254</guid>
		<description>&lt;p&gt;I too thought that my empty functions were simply being optimised away so I added a rand() call inside those, just to make sure they don&#039;t. The total time increased by a few milliseconds so I assume the functions do get invoked.&lt;/p&gt;

&lt;p&gt;I&#039;ll give /RTCsu a go a see if that makes any difference.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I too thought that my empty functions were simply being optimised away so I added a rand() call inside those, just to make sure they don&#8217;t. The total time increased by a few milliseconds so I assume the functions do get invoked.</p>

<p>I&#8217;ll give /RTCsu a go a see if that makes any difference.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: cmroanirgo</title>
		<link>http://www.somethingorothersoft.com/2010/02/02/double-dispatch-rtti-vs-pure-vtable/comment-page-1/#comment-253</link>
		<dc:creator>cmroanirgo</dc:creator>
		<pubDate>Tue, 02 Feb 2010 01:49:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.somethingorothersoft.com/?p=235#comment-253</guid>
		<description>&lt;p&gt;I presume you have checked the resulting assembler that the release mode generated?
The modern C++ optimising compiler is very very clever and may have optimised your sample functions to (essentially) non-existent loops/jumps as part of its loop and branch optimisation.&lt;/p&gt;

&lt;p&gt;Also, in debug mode, try turning off extra stack checks (/RTCsu), which I presume RTTI doesn&#039;t do at anytime (debug or release). Stack checking is off by default in release mode.&lt;/p&gt;

&lt;p&gt;That said, if a real-world result yielded similar results, then it would kind of prove how the compiler can rework your code, mostly for great (and unintended) benefits.&lt;/p&gt;

&lt;p&gt;It has always been my opinion that vtable is oodles faster than RTTI. Although, in fairness, my last set of RTTI tests were done before this millennium started, so my opinion shouldn&#039;t mean much in this case :)&lt;/p&gt;

&lt;p&gt;Well done.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I presume you have checked the resulting assembler that the release mode generated?
The modern C++ optimising compiler is very very clever and may have optimised your sample functions to (essentially) non-existent loops/jumps as part of its loop and branch optimisation.</p>

<p>Also, in debug mode, try turning off extra stack checks (/RTCsu), which I presume RTTI doesn&#8217;t do at anytime (debug or release). Stack checking is off by default in release mode.</p>

<p>That said, if a real-world result yielded similar results, then it would kind of prove how the compiler can rework your code, mostly for great (and unintended) benefits.</p>

<p>It has always been my opinion that vtable is oodles faster than RTTI. Although, in fairness, my last set of RTTI tests were done before this millennium started, so my opinion shouldn&#8217;t mean much in this case :)</p>

<p>Well done.</p>]]></content:encoded>
	</item>
</channel>
</rss>
