glob2-devel
[Top][All Lists]
Advanced

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

Re: [glob2-devel] forums! nuag eplease read thx


From: cyrille . dunant
Subject: Re: [glob2-devel] forums! nuag eplease read thx
Date: Wed, 28 Dec 2005 22:44:12 +0100
User-agent: Internet Messaging Program (IMP) 3.2.8

> 5) Some statements he did like "it's memory optimized instead of speed
> optimized" are ... wrong ?
> Well which of these two lines is faster:
> (y << wDec | x)
> (y*w + x)
> He says the second is faster, and I don't see why, because I think it's
> either the same or the first is faster. Can someone explain me why ?
>

The first one should be faster : less micro-ops in the resulting assembly, I
would expect.

However, it might very well be that the compiler is better at optimizing the
second line... This *might* result in slightly better cache use. But as this is
a kind of optimization that is super compiler- and optimization-level-
dependant, you might as well do nothing :)

> Computer never do it the way you expect it....

Especially not when the compiler tries to be clever. Sometimes, the naive code
is better than the optimized, just because the compiler is so much better at
optimizing naive code...

CU

 -- CFD

PS my message said essentially "beware compilers !"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]