Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] Re: [PATCH] Re: {gen,spec,sort}list stuff
Home

[Freeciv-Dev] Re: [PATCH] Re: {gen,spec,sort}list stuff

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv Developers <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: [PATCH] Re: {gen,spec,sort}list stuff
From: Justin Moore <justin@xxxxxxxxxxx>
Date: Tue, 18 Sep 2001 09:20:23 -0400 (EDT)

> >    I've saved you some of the trouble.  I made the changes myself and ran
> > the tests.  The results were ... odd.  And somewhat disappointing.  I ran
> > the test (same codebase) on three different machines.
> >
> > CPU/Mem      DLL(s)    Array(s)  Speedup(%)
> > 486-66/32     7382      7259       ~2
> > PII-300/128   579.1 579.2     none
> > AMD-1200/900  236.7     246.8      ~4
> >
> >    These were all-AI games with the same .civserverrc on each.  Each was
> > done with a 'make clean && make' at the top-level to ensure a complete
> > switch from one to the other.  Each version was run ten times, the high
> > and low times thrown out, then an average of each.
>
> > Approximately 80% of the old style iterators were converted to the
> > array lists.
>
> The question is: are these converted iterators the "high volume"
> ones?! You have to find iterations which are used a lot.

   Sorry, should have chosen better words.

Test         # of "genlist_iterator_init" calls
linked list    133926755
array           10080001

   Looks like 92.5% of the old iterators are gone.

> > The performance gain is there (kind of), but nowhere near my initial
> > promises.  I think part of the problem may be due to the fact that the
> > ITERATOR_* calls are now function calls, but that wouldn't explain the
> > paltry difference.  I guess gcc just manages to optimize most of the
> > pointer chasing.
>
> Functions calls can cost you a percent or two. But are function calls
> really needed for unchecked access?

   They were needed because a) the ?: logic for some of this would have
become essentially unreadable, and b) there were scoping problems if I had
tried to use a macro.

> >    I just collapsed some of it to make the code cleaner.  Code is
> > available if there's still any interest in these patches.
>
> Before you stop this please post the code.

   Here's the genlist stuff itself.  If you want everything -- including
the changes to the rest of the tree -- that could take a while since that
devel tree is about two weeks old and would need to be merged with the
current CVS.

> >    If I submit the patch, I could always just leave the naming up to you.
>
> These were just suggestions.

   And rather than back-and-forth, I'd rather just leave the naming up to
the others if my names aren't accepted.  I think this counts as my 90%
contribution; I'll leave the other 90% of the time (naming and semantics)
to others. :)

-jdm

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

Attachment: genlist.h
Description: header and macros

Attachment: genlist.c
Description: functions and such


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