[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: c++ question: code duplication across classes
From: Benoit Jacob <jacob () math ! jussieu ! fr>
Date: 2006-09-20 9:01:12
Message-ID: Pine.LNX.4.64.0609201055020.7064 () galois2 ! math ! jussieu ! fr
[Download RAW message or body]
On Wed, 20 Sep 2006, Sylvain Joyeux wrote:
>> so, what is the answer to my question: does that inflate the sizeof of my
>> class? If I construct 1000 objects of this class, will the vtable be
>> replicated 1000 times ? (I warned you it was a stupid question...)
> No, you would have at most one vtable per DSO. Moreover, the ABI used by
> latest g++s also mandates that the vtable is shared across DSOs
erm, could you please tell me what is a DSO? I saw it stands for Dynamic
Shared Object, but I don't understand what that is.
>
>> For the speed overhead, thanks, I'll look for docs to see if this is still
>> an issue.
> Modern CPUs do branch prediction on vtable-like calls, and in your case this
> would work very well if you don't mix calls to one kind of matrix with calls
> to another one, which is the case on class methods.
What is Modern here? My target machines include Pentium III and Athlon.
So, from what you say, I now have 3 options, each of which come at no
speed overhead and no sizeof overhead:
- the CRTP trick
- the virtual methods
- my original idea: global function templates, no inheritance
which one would you choose?
Again: many thanks
Benoit
> --
> Sylvain
>
>>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
>
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic