[Freeciv-Dev] Re: Server Error (PR#666)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
>> The effect is barely noticable and this is a CPU intensive part.
The effect is you can draw a straight line from north pole to
south pole without touching any island at x=0. This is normal
with 9 islands but weird with 90 islands.
The CPU time saving is avoiding calls to normalize_map_pos()
(s-n)*(e-w) times, only calling is_coastline() islemass times.
> The compiler is perfectly capable of performing that sort of trivial
> optimisation itself. Or at least it should. 8-)
Unfortunately, it doesn't. At least not with gcc on x86 platforms.
Diffing with "gcc -O3 -S" gives: (only essential parts are shown)
- movl 16(%ebp),%eax ; (x+xo-w)
- addl %ebx,%eax
- subl %esi,%eax ; %esi is w
+ leal -1(%ebx,%esi),%eax ; (x+xo-1) %esi is xo
and
- incl %ebx ; for(x=w;x<e;x++)
- cmpl %edi,%ebx
- jl .L11
+ decl %ebx ; do while(--x)
+ jne .L11
Regards,
I.Q.
______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup
|
|