[Freeciv-Dev] Re: Map coordinate cleanups.
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Fri, Aug 17, 2001 at 08:43:17AM -0700, Kevin Brown wrote:
> The real question, of course, is just how much of a difference does it
> really make? It's worth putting something into a macro instead of a
> function if it gives you an order of magnitude speedup for a
> significant (30% or so) part of the execution of the program, but
> anything less than that isn't even worth the hassle unless the use of
> a macro instead of a function gives you other benefits (readability,
> ease of comprehension, flexibility, etc.). And keep in mind that the
> macro has to be that much faster than an *inline* function, which
> means that the optimizer has to make that much of a difference. I'll
> concede that this is possible, but I have trouble imagining that it
> would happen often enough to make use of macros the preferred method
> of improving performance.
Theoretically, there is no difference between a macro and an inline
function. Neither needs to push arguments into stack space, jump
elsewhere, etc.
When the code for the non-inline function is dominated by the call
overhead (as many one or two-line functions will be!) then a macro probably
makes serious performance gains possible.
I wouldn't be surprised if a lot of the is_real_tile(), etc style
code that has been discussed recently was turned into 3 or fewer machine
instructions on modern hardware. (68K, i386, PPC, Sparc, etc).
Compile it and see.
--
Anthony J. Stuckey stuckey@xxxxxxxxxxxxxxxxx
"And they said work hard, and die suddenly, because it's fun."
-Robyn Hitchcock.
- [Freeciv-Dev] Re: Map coordinate cleanups., (continued)
- [Freeciv-Dev] Re: Map coordinate cleanups., Gaute B Strokkenes, 2001/08/16
- [Freeciv-Dev] Re: Map coordinate cleanups., Jason Dorje Short, 2001/08/16
- [Freeciv-Dev] Re: Map coordinate cleanups., Kevin Brown, 2001/08/16
- [Freeciv-Dev] Re: Map coordinate cleanups., Vasco Alexandre Da Silva Costa, 2001/08/16
- [Freeciv-Dev] Re: Map coordinate cleanups., Kevin Brown, 2001/08/17
- [Freeciv-Dev] Re: Map coordinate cleanups., Raimar Falke, 2001/08/17
- [Freeciv-Dev] Re: Map coordinate cleanups., Kevin Brown, 2001/08/17
- [Freeciv-Dev] Re: Map coordinate cleanups., Raimar Falke, 2001/08/17
- [Freeciv-Dev] Re: Map coordinate cleanups., Kevin Brown, 2001/08/17
- [Freeciv-Dev] Re: Map coordinate cleanups., Gaute B Strokkenes, 2001/08/19
- [Freeciv-Dev] Re: Map coordinate cleanups.,
Tony Stuckey <=
- [Freeciv-Dev] Re: Map coordinate cleanups., Vasco Alexandre Da Silva Costa, 2001/08/17
- [Freeciv-Dev] Re: Map coordinate cleanups., Justin Moore, 2001/08/17
- [Freeciv-Dev] Re: Map coordinate cleanups., Kevin Brown, 2001/08/17
- [Freeciv-Dev] Re: Map coordinate cleanups., Raimar Falke, 2001/08/19
- [Freeciv-Dev] Re: Map coordinate cleanups., Ross W. Wetmore, 2001/08/19
- [Freeciv-Dev] Re: Map coordinate cleanups., Raimar Falke, 2001/08/19
- [Freeciv-Dev] Re: Map coordinate cleanups., Jason Dorje Short, 2001/08/19
- [Freeciv-Dev] Re: Map coordinate cleanups., Raimar Falke, 2001/08/19
- [Freeciv-Dev] GTK client draws more slowly than it needs to, Kevin Brown, 2001/08/19
- [Freeciv-Dev] Re: GTK client draws more slowly than it needs to, Raimar Falke, 2001/08/20
|
|