Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] Re: Profile.
Home

[Freeciv-Dev] Re: Profile.

[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: Profile.
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 28 Sep 2001 09:55:18 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Fri, Sep 28, 2001 at 02:30:33AM +0200, Gaute B Strokkenes wrote:
> On Wed, 26 Sep 2001, hawk@xxxxxxxxxxxxxxxxxxxxxxx wrote:
> 
> > diff -urd -x prof -X freeciv.current/diff_ignore work/common/map.c 
> > no_check/common/map.c
> > --- work/common/map.c       Wed Sep 26 14:21:08 2001
> > +++ no_check/common/map.c   Wed Sep 26 18:31:26 2001
> > @@ -1289,7 +1289,9 @@
> >  
> >  int is_real_tile(int x, int y)
> >  {
> > -  return 0 <= y && y < map.ysize;
> > +  int x1 = x, y1 = y;
> > +
> > +  return normalize_map_pos(&x1, &y1);
> >  }
> >  
> >  /**************************************************************************
> > @@ -1302,10 +1304,7 @@
> >    while (*x >= map.xsize)
> >      *x -= map.xsize;
> >  
> > -  if (!is_real_tile(*x, *y))
> > -    return FALSE;
> > -
> > -  return TRUE;
> > +  return (0 <= *y && *y < map.ysize);
> >  }
> >  
> >  /**************************************************************************
> 
> I would do this the other way round; change the end of
> normalize_map_pos() to read "return is_real_tile(*x, *y)" and leave
> is_real_tile() as-is.

It is one extra function call. This simple change will give us 3-5%
gain. normalize_map_pos is far more used than is_real_tile.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "#!/usr/bin/perl -w
  if ( `date +%w` != 1 ) {
    die "This script only works on Mondays." ;
  }"
    -- from chkars.pl by Cornelius Krasel in de.comp.os.linux.misc


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