Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2001:
[Freeciv-Dev] Re: Server Error (PR#666)
Home

[Freeciv-Dev] Re: Server Error (PR#666)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Server Error (PR#666)
From: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>
Date: Wed, 31 Jan 2001 03:34:13 +0000 (WET)

On Tue, 30 Jan 2001, [BIG5] ½²«íµØ wrote:

> The CPU time saving is avoiding calls to normalize_map_pos()
> (s-n)*(e-w) times, only calling is_coastline() islemass times.
> > The compiler is perfectly capable of performing that sort of trivial
> > optimisation itself.  Or at least it should.  8-)
> Unfortunately, it doesn't. At least not with gcc on x86 platforms.
> Diffing with "gcc -O3 -S" gives: (only essential parts are shown)

Yes that's typical.  I made a raytracer with a matrix multiply function
sort of like this:

for (i=0; i<4; i++)
{
  for (j=0; j<4; j++)
  {
    ...
  }
}

And the stupid thing (gcc -O3 -mcpu=i686) didn't unroll the inner loop!
If it can't unroll something like this i wonder what kind of loops it does
unroll...

BTW: i unrolled the inner loop by hand and the damned thing raytraced
that scene 35% faster.  Silly...

And today's motto is:  you can't trust a compiler to optimize your code
properly.

---
Vasco Alexandre da Silva Costa @ Instituto Superior Tecnico, Lisboa






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