Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] (PR#9869) Bug: DDEBUG changes savegames
Home

[Freeciv-Dev] (PR#9869) Bug: DDEBUG changes savegames

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9869) Bug: DDEBUG changes savegames
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxxx>
Date: Mon, 30 Aug 2004 22:35:32 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9869 >

> > Fourth, why don't you make a patch ;)
> 
> Attached.  Is this sufficient to fix the DEBUG problem?
> 
> jason

As I said, Jason's patch fixes the problem.  But having inline sometimes
gives increase in the run time (and sometimes not).  So I propose we fix
the user of index_to_map_pos (attached patch) and leave Jason to worry
about capitalizing or inlining the function.

with jason's patch:
26.600u 0.170s 0:27.07 98.8%  0+0k 0+0io 457pf+0w
26.660u 0.130s 0:27.13 98.7%  0+0k 0+0io 457pf+0w

with my patch:
26.570u 0.090s 0:27.06 98.5%  0+0k 0+0io 456pf+0w
(and then I made some more runs)
26.790u 0.190s 0:27.63 97.6%  0+0k 0+0io 469pf+0w
26.850u 0.100s 0:27.35 98.5%  0+0k 0+0io 468pf+0w

So I dont know.
? saves
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.188
diff -u -r1.188 map.c
--- common/map.c        25 Aug 2004 18:24:19 -0000      1.188
+++ common/map.c        31 Aug 2004 05:20:14 -0000
@@ -1590,7 +1590,10 @@
   /* First do a few quick checks to find a spot.  The limit on number of
    * tries could use some tweaking. */
   do {
-    index_to_map_pos(x, y, myrand(map.xsize * map.ysize));
+    int index = myrand(map.xsize * map.ysize);
+
+    /* Currently index_to_map_pos evaluates its arguments more than once */
+    index_to_map_pos(x, y, index);
   } while (filter && !filter(*x, *y, data) && ++tries < max_tries);
 
   /* If that fails, count all available spots and pick one.

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