[XviD-devel] optimizations
Christoph Lampert
chl at math.uni-bonn.de
Sat Apr 5 18:26:55 CEST 2003
On Sun, 6 Apr 2003, Radek Czyz wrote:
> Hi,
> I was doing a bit of profiling/optimizations today. My target was
> d_mv_bits(), as it wasn't so fast so I thought and is used in
> almost every checkcandidate.
>
> Now the funny part: we use ABS() there. Twice. It's a macro, #defined
> as (X<0?-X:X) which looks cool. However, this is _not_ the tricky
> abs() used by MSVC, so it produces branches. My question is why do we
> use macro, if compiler's abs() works either better (MSVC) or at least
> not worse (gcc 2.9) ? Is there any reason?
No. Simply replace it.
It's because in the old days of computing, this macro was faster than
a (non-inlined) call to abs(). This is not true anymore.
> I was able to remove the two other branches from this function and now
> CodeAnalyst is unable to measure any time taken by this computation
> (the average was 33 cycles, now it's more like 0.5 <-- I don't think
> it's a real value)
Good work!
gruel
More information about the XviD-devel
mailing list