FYI, RTTI and performance. 
Author Message
 FYI, RTTI and performance.

Some time ago I started a, somewhat spirited, discussion as to why RTTI was
off by default, during the discussion the performance implications of enabling
RTTI were addressed, but no actual data was to be found.

I finally managed to find the time to get a reasonable testbench set up for my
application and I ran a few comparisons. For this particular application I
could detect no degradation of performance.
No RTTI: 9.7-9.9 seconds
With RTTI: 9.7-9.9 seconds

YMMV

Regards /Magnus Lidbom



Sat, 23 Jul 2005 23:43:09 GMT  
 FYI, RTTI and performance.

Quote:
> Some time ago I started a, somewhat spirited, discussion as to why
RTTI was
> off by default, during the discussion the performance implications of
enabling
> RTTI were addressed, but no actual data was to be found.

> I finally managed to find the time to get a reasonable testbench set
up for my
> application and I ran a few comparisons. For this particular
application I
> could detect no degradation of performance.
> No RTTI: 9.7-9.9 seconds
> With RTTI: 9.7-9.9 seconds

That's what I'd expect - RTTI only adds static data, so it results in an
increase in application size.  There's a chance that a size increase
could decrease the cache-hit rate (by decreased locality of reference),
but IME that's more a theoretical argument than one based in actual
measurement.

Did your test attempt to compare the performance of dynamic_cast to
static_cast?  That's the only RTTI-releated feature where there IS a
definite performance difference (of course, there's also a safety
difference - you get what you pay for).

-cd



Sun, 24 Jul 2005 01:17:42 GMT  
 FYI, RTTI and performance.



Quote:


> > Some time ago I started a, somewhat spirited, discussion as to why
> RTTI was
> > off by default, during the discussion the performance implications of
> enabling
> > RTTI were addressed, but no actual data was to be found.

> > I finally managed to find the time to get a reasonable testbench set
> up for my
> > application and I ran a few comparisons. For this particular
> application I
> > could detect no degradation of performance.
> > No RTTI: 9.7-9.9 seconds
> > With RTTI: 9.7-9.9 seconds

> That's what I'd expect - RTTI only adds static data, so it results in an
> increase in application size.  There's a chance that a size increase
> could decrease the cache-hit rate (by decreased locality of reference),
> but IME that's more a theoretical argument than one based in actual
> measurement.

> Did your test attempt to compare the performance of dynamic_cast to
> static_cast?

No. I changed no code.  I've eliminated the need for the downcasts I used
before, they were a product of an improper design.

I need RTTI now because I intend to implement a mapping of functors to strings
that is separate for each subclass of my baseclass. I'll be using a
map<Loki::TypeInfo, map<std::string, MyLokiFunctorType> >
to implement this, that's why I need RTTI.

Any thoughts on this approach are welcome, I'm somewhat uncertain as to the
merit of the design myself. However, the only alternative approach I've come
up with is to subclass my baseclass with at template class that is
parameterized by it's own subclasses, this would perform better, but what a
pain to implement :/ .

Quote:
> That's the only RTTI-releated feature where there IS a
> definite performance difference
> (of course, there's also a safety
> difference - you get what you pay for).

Perhaps I'll take a look at that sometime, but it won't happen now, way to
busy.

Regards /Magnus Lidbom



Sun, 24 Jul 2005 02:57:43 GMT  
 FYI, RTTI and performance.

Quote:

> Some time ago I started a, somewhat spirited, discussion as to why RTTI
> was off by default, during the discussion the performance implications
> of enabling RTTI were addressed, but no actual data was to be found.

As Carl pointed out, it's more likely to be size optimization for code that
doesn't use dynamic_cast. For what it's worth, we are willing to reconsider
defaults in an upcoming version of the compiler.

--
Brandon Bray                                          Visual C++ Compiler
This posting is provided AS IS with no warranties, and confers no rights.



Sun, 24 Jul 2005 03:39:45 GMT  
 FYI, RTTI and performance.



Quote:

> > Some time ago I started a, somewhat spirited, discussion as to why RTTI
> > was off by default, during the discussion the performance implications
> > of enabling RTTI were addressed, but no actual data was to be found.

> As Carl pointed out, it's more likely to be size optimization for code that
> doesn't use dynamic_cast. For what it's worth, we are willing to reconsider
> defaults in an upcoming version of the compiler.

Oops, I didn't intend to reopen that can of worms, I just figured people might
be interested in the results I got. A more compliant default setting for
future versions of VC would be nice though.

Regards /Magnus



Sun, 24 Jul 2005 03:45:22 GMT  
 FYI, RTTI and performance.

Quote:
> [...] For what it's worth, we are willing to reconsider
> defaults in an upcoming version of the compiler.

  I'd love to have RTTI enabled by default.
  I guess there's no way to get that into 7.1?

Quote:
> Brandon Bray                                          Visual C++ Compiler

  Schobi

--

I'm Schobi at suespammers org



Sun, 24 Jul 2005 05:17:23 GMT  
 FYI, RTTI and performance.
Or better yet, some enterprise function where you can define the defaults
for your organization. There are a lot of defaults that I would like tho
change for everyone who installs VC.Net in our organization. Better this
than to have to write your own wizard which you have to remember to
distribute.

/Andreas

Quote:

> > [...] For what it's worth, we are willing to reconsider
> > defaults in an upcoming version of the compiler.

>   I'd love to have RTTI enabled by default.
>   I guess there's no way to get that into 7.1?

> > Brandon Bray                                          Visual C++
Compiler

>   Schobi

> --

> I'm Schobi at suespammers org



Sun, 24 Jul 2005 16:05:50 GMT  
 FYI, RTTI and performance.
The project and solution template support in the Enterprise Architect
edition (for authoring the templates) and the Enterprise Developer edition
(for consuming them) is supposed to address this.

Do you have any feedback on whether that would be suitable, or what the
delta is between that and what you would like to see?

Thanks.

Ronald Laeremans
Visual C++ team


Quote:
> Or better yet, some enterprise function where you can define the defaults
> for your organization. There are a lot of defaults that I would like tho
> change for everyone who installs VC.Net in our organization. Better this
> than to have to write your own wizard which you have to remember to
> distribute.

> /Andreas



> > > [...] For what it's worth, we are willing to reconsider
> > > defaults in an upcoming version of the compiler.

> >   I'd love to have RTTI enabled by default.
> >   I guess there's no way to get that into 7.1?

> > > Brandon Bray                                          Visual C++
> Compiler

> >   Schobi

> > --

> > I'm Schobi at suespammers org



Mon, 25 Jul 2005 06:26:48 GMT  
 FYI, RTTI and performance.
Ah, I got the impression that these were targeted for "more serious .Net
work". I haven't looked at them though (but I will...) Thanks for the
pointer.

/Andreas


Quote:
> The project and solution template support in the Enterprise Architect
> edition (for authoring the templates) and the Enterprise Developer edition
> (for consuming them) is supposed to address this.

> Do you have any feedback on whether that would be suitable, or what the
> delta is between that and what you would like to see?

> Thanks.

> Ronald Laeremans
> Visual C++ team



> > Or better yet, some enterprise function where you can define the
defaults
> > for your organization. There are a lot of defaults that I would like tho
> > change for everyone who installs VC.Net in our organization. Better this
> > than to have to write your own wizard which you have to remember to
> > distribute.

> > /Andreas



> > > > [...] For what it's worth, we are willing to reconsider
> > > > defaults in an upcoming version of the compiler.

> > >   I'd love to have RTTI enabled by default.
> > >   I guess there's no way to get that into 7.1?

> > > > Brandon Bray                                          Visual C++
> > Compiler

> > >   Schobi

> > > --

> > > I'm Schobi at suespammers org



Mon, 25 Jul 2005 16:18:30 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. RTTI - is it good or bad (performance, etc.)?

2. RTTI - is it good or bad (performance, etc.)?

3. ListView performance - I will pay you to increase performance of this:

4. FYI: C answers in visual_c kb at MS

5. FYI: Prob with SpeechLib Release Version

6. FYI: Programming Pearls 2nd Ed

7. Amazon.com on Computer Books (FYI)

8. FYI: A Truly pd yacc. (zoo)

9. FYI MIDL compiler upgrade

10. FYI: Hard-to-find memory leak

11. FYI: OpenRecordSet() and SQL w/aggregates

 

 
Powered by phpBB® Forum Software