Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2004:
[Freeciv-Dev] Re: (PR#7195) inlining map_pos_to_index
Home

[Freeciv-Dev] Re: (PR#7195) inlining map_pos_to_index

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jshort@xxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7195) inlining map_pos_to_index
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Mon, 5 Jan 2004 23:08:03 -0800
Reply-to: rt@xxxxxxxxxxx

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

On Mon, Jan 05, 2004 at 01:50:57PM -0800, Brandon J. Van Every wrote:
> 
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7195 >
> 
> Marek wrote:
> > RossW wrote:
> >  
> > > The key elements are:
> > > 1)  inline functions are merely a *hint* to the compiler 
> > >      with no hard requirement to actually inline the code.
> > 
> > But a darn strong one. In gcc, defining a function as extern inline
> > makes the compiler to not emit the body of the function (ie. doing
> > &inlined_function would result in link error.)
> 

> Ok, I've been trying really hard to shut up, and succeeding.  But
> I'm now going to obnoxiously interject in an increasingly obnoxious
> discussion.  Having spent my entire career on low-level ASM
> optimization bullshit, and having seen *plenty* of inline compilers,
> I'm inclined to weigh in on this language religious wars
> gobbledygook nonsense.
> 
> There are 2 issues:
> 1) *WHY* are you trying to optimize?  Really, what's in it for you?
> 2) If you are trying to optimize, *WHAT COMPILER* are you using?

> (1) is the bit that's ticking me off.  Here you are, yadda yadding
> about C style this or that.  It's micromanagerial, and misses the
> forest for the sake of the trees.  Strategically you should *either*
> be doing something OO in a higher level language, 'cuz optimization
> usually doesn't impact the bottom line and your programmer time is
> better spent, *or* implement a very obvious / needed performance
> improvement.  And it seems like the case under current discussion is
> the latter, so what's all the pissing and moaning about macros
> vs. inlines about?  IF IT WORKS, USE IT.

I think that is a valid point. Freeciv has no hardware requirements
like commercial games have. This leads to a "lets make it as fast as
we can since there may be slow hardware out there". But even with a
fast hardware (1GHz+ CPU) you can watch it crawl when you do an
autogame (set timeout to -1 and use only AI players).

Another aspect of this is that we are human ("if a change this I will
get a speed increase of 15%. Why can't we do this?") and are _NOT_
bound by resources like commercial developers.

> (2) adds insult to injury.  GCC might be *wonderful* at inlining.
> I'm using Visual Studio .NET 2003, and I can assure you its inlining
> is bollocks.

Another valid point BUT inlining is part of C99. If your compiler
doesn't understand it get a better one. Also gcc is available also for
your platform.

> People tell me the Intel compiler ain't so hot either.

This isn't true. The intel compiler 6.0 produced code which is 10-15%
faster than gcc 2.96 with comparable switches. You could use some
extra switches to increase it by another 10-15%. See the archive for
the numbers.

> Ergo, in cross-platform development, you cannot make assumptions
> about what will or won't be inlined.  Maybe it works *great*.  Maybe
> it works *terrible*.  There's no a priori reason to decide one way
> or the other.  The worthwhile general recommendations are:
> 
> 1) feel free to #ifdef based on target compiler
> 2) don't assume lotsa inlines will play well with each other
> 3) don't assume long inlines will get inlined

I have no problem adding to the INSTALL file:

  Freeciv requires a compiler which understands inlining according to
  the C99 standard. Compiler foo and bar are reported to not support
  these or do the wrong thing. It is recommended to use gcc or the
  intel compiler in this case.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  The Software is not designed or licensed for use in on-line control
  equipment in hazardous environments, such as operation of nuclear
  facilities, aircraft navigation or control, or direct life support
  machines. 
    -- Java Compiler Compiler Download and License Agreement




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