wesnoth-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-dev] Improving startup time


From: Yann Dirson
Subject: [Wesnoth-dev] Improving startup time
Date: Thu, 9 Jun 2005 23:24:30 +0200
User-agent: Mutt/1.5.6+20040907i

One thing that strikes me when running with all logs enabled (esp. on
ipaq where startup takes soooo much time) is that many files are read
at game startup, without an apparent need for them.  Then they are
read again when we start a real game.

Most notably, all the units, and utils.cfg fall in this category.  The
latter is in my list because it takes ages to preprocess on the ipaq.

It may be a bit late to reengineer how files are read and fix this in
a clean way, but we should at least avoid to read useless data.

All of those files could be be included inside the game defines.  As a
test I have moved the [+units] block from game.cfg to a new units.cfg,
and include that file only from within #ifdef TUTORIAL or #ifdef
MULTIPLAYER, and things run fine.

Where there is a problem is with campaigns, since there is no single
#define for them, and it is surely not an option to break all user
campaigns at this point by requiring them to include units.cfg.  It
would be much cleaner to add a new CAMPAIGN define for this usage.
I've quickly looked at how we could do that.

Here is my patch, which works for me (I have stripped the move to
units.cfg for clarity).  Do I have approval for commit ?  Do we want
something more sophisticated for 1.0 ?

Index: data/game.cfg
===================================================================
RCS file: /cvsroot/wesnoth/wesnoth/data/game.cfg,v
retrieving revision 1.162
diff -u -r1.162 game.cfg
--- data/game.cfg       1 Jun 2005 22:25:43 -0000       1.162
+++ data/game.cfg       9 Jun 2005 21:15:45 -0000
@@ -489,1225 +489,12 @@
                [/defense]
 #enddef
 
-[+units]
....
-[/units]
+#ifdef CAMPAIGN
+{units.cfg}
+#endif
 
 #ifdef TUTORIAL
+{units.cfg}
 {scenarios/tutorial}
 #endif
 
Index: data/multiplayer.cfg
===================================================================
RCS file: /cvsroot/wesnoth/wesnoth/data/multiplayer.cfg,v
retrieving revision 1.107
diff -u -r1.107 multiplayer.cfg
--- data/multiplayer.cfg        2 Jun 2005 18:56:24 -0000       1.107
+++ data/multiplayer.cfg        9 Jun 2005 21:15:46 -0000
@@ -12,6 +12,7 @@
 [/generic_multiplayer]
 
 #ifdef MULTIPLAYER
+{units.cfg}
 {scenarios/multiplayer/}
 #endif
 
Index: src/game.cpp
===================================================================
RCS file: /cvsroot/wesnoth/wesnoth/src/game.cpp,v
retrieving revision 1.252
diff -u -r1.252 game.cpp
--- src/game.cpp        4 Jun 2005 19:16:05 -0000       1.252
+++ src/game.cpp        9 Jun 2005 21:15:51 -0000
@@ -635,6 +635,7 @@
                const std::string& campaign_define = cfg["campaign_define"];
                if(campaign_define.empty() == false) {
                        defines_map_[campaign_define] = preproc_define();
+                       defines_map_["CAMPAIGN"] = preproc_define();
                }
 
                refresh_game_cfg();
@@ -794,6 +795,7 @@
        }
 
        state_.campaign_define = campaign["define"];
+       defines_map_["CAMPAIGN"] = preproc_define();
 
        return true;
 }

-- 
Yann Dirson    <address@hidden> |
Debian-related: <address@hidden> |   Support Debian GNU/Linux:
                                    |  Freedom, Power, Stability, Gratis
     http://ydirson.free.fr/        | Check <http://www.debian.org/>




reply via email to

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