Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2004:
[Freeciv-Dev] Re: (PR#7279) Macro optimizations
Home

[Freeciv-Dev] Re: (PR#7279) Macro optimizations

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: a-l@xxxxxxx
Cc: mburda@xxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7279) Macro optimizations
From: "rwetmore@xxxxxxxxxxxx" <rwetmore@xxxxxxxxxxxx>
Date: Tue, 3 Feb 2004 10:41:29 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7279 >


Arnstein Lindgard wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7279 >
> 
> On Mon, 26 Jan 2004 18:44:01 -0800 rwetmore@xxxxxxxxxxxx wrote:
> 
> I wrote:
[...]
> On the other hand, gcc states that
> 
>   "An Inline is As Fast As a Macro".
> 
> So why not use inline for map_get_tile() and such?

An inline *can* be as fast as a macro. It needn't be in any given
situation. But it is interesting that even GCC recognizes with this
statement that macros are *always* going to be as good or better.

Code must also be inlined before this applies and the compiler is
*never* required to respond to the hint to inline.

Thus many code situations *labelled* with the hint, may in fact
be compiled to execute function calls. There is *no* way to determine
this a priori - that is what the standards state.

Thus there is *never* any performance benefit to inlining over macros.
This is clear from fact and minimal logic and is frankly unrefutable.

[...]
> No. My particular epiphany is to rethink conservatism whenever the
> original arguments may have expired.

They clearly have not :-).

The C++ religion is still trying to supplant "C" and forcce its
inefficiencies and restrictions into programs that were coded with
another paradigm that best suits their needs. Big brother is alive
and well in those that would rather spend time telling people how
they should write code than actually writing good code that furthers
something like game play.

[...]
> Arnstein

Cheers,
RossW
=====




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