[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: c++ question: code duplication across classes
From: Guillaume Laurent <glaurent () telegraph-road ! org>
Date: 2006-09-20 8:23:45
Message-ID: 4510FA91.9080304 () telegraph-road ! org
[Download RAW message or body]
Thiago Macieira wrote:
> Benoît Jacob wrote:
>
>> is the overhead for virtual methods a speed overhead ?
>>
>
> The overhead of a virtual method is an indirect jump (instead of a direct
> one). This used to be a problem because it would throw off all prediction
> done in modern CPUs, because they didn't predict indirect branches. I
> don't know if that's still true.
>
> So, if you can, avoid virtuals if speed is an issue.
>
Last time I tried to measure the speed overhead of a virtual method,
that was about 3 years ago on a Pentium 3, and it would take millions of
calls for the overhead to be noticeable. Which is quite possible when
doing computations in a large matrix.
--
Guillaume
http://telegraph-road.org
>> 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