Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2001:
[Freeciv-Dev] Re: capability patch
Home

[Freeciv-Dev] Re: capability patch

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: capability patch
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 18 Feb 2001 19:00:04 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxxxx

On Sun, Feb 18, 2001 at 04:05:41PM +0000, Vasco Alexandre Da Silva Costa wrote:
> Since there were complains about the speed of the has_capability() &
> has_capabilities() functions i looked at the code and noticed
> has_capability() called my_strdup() once per call.  So i removed those
> calls by changing the code.  The new functions are > 50%  faster depending
> on the capstrings you're searching.

My previous code made a lot of network traffic. This traffic consists
mainly of city_info packets. In an inner loop {put,iget}_worklist use
has_capability. My current code doesn't create large amount of network
traffic so from my side this is now a non-issue.

Since the capabilities doesn't change, at that time I thought about
adding extra fields (e.g. has_worklist_true_ids) to struct connection
which could later tested easily. It may also possible to split the
capstring and put these strings as keys into an hashtable. This
hashtable should also be an extra field of struct connection. But it
is also possible to profile the stuff and only change to hot spots.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "USENET is *not* the non-clickable part of WWW!"



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