[Freeciv-Dev] Re: capability patch
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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!"
|
|