Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: Profiling Civserver again
Home

[Freeciv-Dev] Re: Profiling Civserver again

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gaute B Strokkenes <gs234@xxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Profiling Civserver again
From: Paul Zastoupil <paulz@xxxxxxxxxxxx>
Date: Thu, 2 Aug 2001 17:52:57 -0700

On Fri, Aug 03, 2001 at 02:07:11AM +0200, Gaute B Strokkenes wrote:
> On Thu, 02 Aug 2001, gs234@xxxxxxxxx wrote:
> > On Wed, 1 Aug 2001, vasc@xxxxxxxxxxxxxx wrote:
> >> Well does gcc optimize it this way?
> >> 
> >> #define map_adjust_x(X) \
> >>   (((X) % map.xsize) + (((X >= 0) - 1) & map.xsize))
> > 
> > You mean * rather than &, right?
> 
> Ah, that's 0 or -1, not 1 or 0.  So it works.  Clever.
> 
> >> This is faster. Its faster on all CPUs. Notice it doesn't have any
> >> branches. Of course its also pretty darn unreadable :-)
> > 
> > I'm sceptical.  Note that Gregory's patch, which replaced the
> > modulus operations with two while loops, doubled the speed of
> > normalize_map_pos().  It's too bad that there's no easy way to use
> > loop constructs in macros, short of using inline functions instead.
> > Perhaps the best thing would be to change it to trigger on
> > 
> >   (X) < 0 || (X) >= map.xsize)
> > 
> > instead.  Off course, the proof of the pudding is in the eating:
> > Somebody really ought to profile all these different approaches,
> > etc. etc.
> 
> Paul, could you try this?
> 

http://civserver.freeciv.org/~paulz/gprof-gs234.txt

-- 
Paul Zastoupil


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