Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: improper access of iterators
Home

[Freeciv-Dev] Re: improper access of iterators

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: improper access of iterators
From: Justin Moore <justin@xxxxxxxxxxx>
Date: Sun, 26 Aug 2001 17:40:42 -0400 (EDT)

On Sun, 26 Aug 2001, Raimar Falke wrote:
> On Sun, Aug 26, 2001 at 03:29:01PM -0400, Justin Moore wrote:
> >
> >    In my quest to improve genlist efficiency I've stumbled across some
> > improper use of variables within the AI and server code.  Look at
> > ai/aicity.c:1036.  The unit_list_iterate is defined in terms of the
> > TYPED_LIST_ITERATE macro in common/genlist.h.  The current macro uses a
> > genlist_iterator named myiter that the AI and server code references
> > directly, even though the iterator isn't specifically initialized or even
> > named within the calling code.
> >
> >    What are people's thoughts about me migrating from the old genlist to
> > my new genlist?  My current version of genlist is backwards compatible
> > with the old one.  The implementation of the ITERATOR_* macros are kind of
> > hacks and are probably slightly less efficient than the old ones, but I
> > plan to phase those out if possible.  My idea is to migrate code from the
> > older, slower genlist data structures and iterators to the newer, faster
> > ones.  It would be in a few steps.  If people would like more info on
> > this, I'd be happy to provide it.  I really think we could get a good
> > performance gain out of a more efficient genlist, but I'd like some
> > feedback on my ideas.
>
> You have to show code or provide more details. Overall I think
> dynamically resized arrays are faster then double linked lists. I
> don't think there will be a lot of overall performance gain. I would
> like to see an interface genlist.h and implementations like
> array_genlist.h and dll_genlist.h. This would allow sufficient
> performance testing.

   I'm working on providing some profiling results.  Part of the point of
my post was that it's not quite as simple as re-linking against an array
implementation; some programmers assumed the existance of an iterator
named 'myiter' in a few parts of the code.  I'd have to clean out lots of
those places for a good comparison, resulting in some sizeable patches.  I
guess I'm just asking if it would be worth my time to do this.  I feel
that between the new genlist and some key sortlist improvements, we could
improve speed by 2-3% (IMHO), but again: would the maintainers be
interested in these speedups if available?

-jdm

Department of Computer Science, Duke University, Durham, NC 27708-0129
Email:  justin@xxxxxxxxxxx



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