Re: template classes faster than derived classes?

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

 



>> http://linuxjunk.blogspot.com/2009/11/are-templates-faster-than-subclasses.html

> I didn't see the first version.  In the current version, the templated  
> code is simple enough that the optimizer can figure out the whole thing  
> and skip everything.  The virtual code is not simple enough, so the code  
> actually executes.

Ah ok, so it's able to optimise my loop in to a single multiply here?  That's neat.

> So you still aren't measuring what you set out to measure.

I've constructed a slightly more complicated test:

http://linuxjunk.blogspot.com/2009/11/templates-v-subclasses-v2.html

In this case the templated version doesn't seem to have the same huge
advantage. Templated 20.73s against 21.1s for the classed version. I would guess
real, but not huge.

Do these numbers seem reasonable?

Nav

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux