Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2001:
[Freeciv-Dev] Re: Profiling Civserver again
Home

[Freeciv-Dev] Re: Profiling Civserver again

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Jason Dorje Short <jshort@xxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Profiling Civserver again
From: Trent Piepho <xyzzy@xxxxxxxxxxxxx>
Date: Thu, 26 Jul 2001 01:13:42 -0700 (PDT)

On Thu, 26 Jul 2001, Jason Dorje Short wrote:
> of map nodes (in total) can be found from the number of times
> get_from_mapqueue() is called.  This divides into the total time spent
> in the function - including time spent in called functions.
> 
> I've done five runs.  The values are as follows:
> 
> original code - one run - 1.5 us per map node
> "better" code (my first patch) - 1.4, 1.3, and 1.4 us per map node
> "best" code - one run - 1.2 us per map node

Did you try my version?  I think it will be faster.  It's also cleaner, with
each tile handled in the same manner and less code inside the iterator macro.

I also think you named the macro incorrectly.  All the other iterator macros
end with _iterate, but you ended it with _dir. 

There are currently two sets of DIR_DX arrays.  One is called DIR_DX2 and
differs in the order of the directions.  DIR_DX2 uses a more sensible
method of numbering the tiles clockwise from 0.  It's only used one place
in the tilespec code.  Which is too bad, because it makes more sense to
order the tiles that way.

The cartesian_adjacent_iterate macro could also use this method.  I'd rename
it to adjc_cardinal_iterate too.  If the clockwise ordering is used for
directions, almost the exact same code can be used for this macro as the
adjc_iterate() macro.  The only difference is to increment dir by 2 each
iteration.

It's too bad no one after me took the time to really clean up the code. 
People just keep doing crude hacks, like speeding up a single loop when there
are dozens of identical loops that could be done the same way.  It's just
cleaner to be consistent.  It's really quite depressing watching something
you spent so long trying to write well get turned into a mess of kludges.



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