Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2003:
[Freeciv-Dev] (PR#7062) CM: speeding up cache3 clear
Home

[Freeciv-Dev] (PR#7062) CM: speeding up cache3 clear

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#7062) CM: speeding up cache3 clear
From: "Benoit Hudson" <bh@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 6 Dec 2003 16:05:04 -0800
Reply-to: rt@xxxxxxxxxxx

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

This is a silly patch, but makes a pretty big difference (8s in CM
becomes 7.4s in my server-only game).  Seems we spend a lot of time
clearing cache3.

A side-effect of this patch is that some of the cache1 are kept around
longer than necessary, but we don't leak them.

        -- Benoît

--- cm.c.orig   2003-12-06 12:24:04.000000000 -0500
+++ cm.c        2003-12-06 18:55:53.000000000 -0500
@@ -1248,8 +1248,8 @@
   cache3.pcity = pcity;
   stats.cache3.misses++;
 
-  /* Make cache3 invalid */
-  for (i = 0; i < MAX_FIELDS_USED + 1; i++) {
+  /* Make as invalid the parts of cache3 we'll use. */
+  for (i = 0; i <= MIN(MAX_FIELDS_USED, pcity->size); i++) {
     for (j = 0; j < MAX_COMBINATIONS; j++) {
       cache3.results[i].combinations[j].is_valid = FALSE;
       if (cache3.results[i].combinations[j].cache1) {

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#7062) CM: speeding up cache3 clear, Benoit Hudson <=