[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: c++ question: code duplication across classes
From:       Sylvain Joyeux <sylvain.joyeux () polytechnique ! org>
Date:       2006-09-20 8:47:44
Message-ID: 200609201047.45211.sylvain.joyeux () polytechnique ! org
[Download RAW message or body]

> 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

> 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.
-- 
Sylvain
 
>> 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