Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2003:
[Freeciv-Dev] Re: gtk clients: translate_menu_path
Home

[Freeciv-Dev] Re: gtk clients: translate_menu_path

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Per I. Mathisen" <per@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: gtk clients: translate_menu_path
From: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>
Date: Thu, 16 Oct 2003 15:58:41 +0100 (WET DST)

On Thu, 16 Oct 2003, Per I. Mathisen wrote:

> I just read an old profile of the gtk2 client done by Thomas, and I
> noticed that 18% of CPU time was spent inside translate_menu_path(). This
> is a function that is called once every menu item every turn, at least.
>
> It is a quite expensive function. Is it not possible to make this function
> calculate the result once only, and cache it? Surely the result does not
> change throughout the game for the same set of input. How about putting
> the translated string into hashlist, for instance? Alternatively, we could
> the uses of it turn it into a macro, and make some fancy use of static
> strings to hold this data. This would be even faster.

I can make it faster, but I doubt it is what is making the unit moves
slower.

---
Vasco Alexandre da Silva Costa @ Instituto Superior Tecnico, Lisboa



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