lkml.org 
[lkml]   [2006]   [Mar]   [21]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: gettimeofday order of magnitude slower with pmtimer, which is default
FromArjan van de Ven <>
DateTue, 21 Mar 2006 13:04:44 +0100
On Tue, 2006-03-21 at 22:58 +1100, Con Kolivas wrote:
> On Tuesday 21 March 2006 19:53, Andreas Mohr wrote:
> > (and the fact that invoking a function pointer should be similarly
> > expensive to a conditional) I don't think it's useful.
> 
> Is 
> 
> *blah();
> 
> as expensive as
> 
> if (conditional)
> 	blah();
> 
> I don't know the answer. I just know cmp is expensive. Comments?

function pointer is usually MORE expensive.
for if() the processor has a change to predict the branch right, while
call <register> (which is what function pointer calls end up being) are
basically always mispredicted unless you have a really really fancy
branch predictor... 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-03-21 12:07    [from the cache]
©2003-2008