Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2002:
[Freeciv-Dev] Re: [RFC][Patch] Inline
Home

[Freeciv-Dev] Re: [RFC][Patch] Inline

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx, freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: [RFC][Patch] Inline
From: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Date: Thu, 21 Mar 2002 03:12:54 -0800 (PST)

--- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> 
> There was a major network breakdown (three universities and ten other
> research institutes were offline). So I could commit patches. I took
> the time to work in the performance front.
> 
> The attached patch is a first cut on inlining functions. It does:
>  - move city and unit list to their own files: unit_list.[ch] and
>  city_list.[ch]
>  - demerge dependencies
>  - add missing dependencies
>  - move type declaration into new files improvement_types.h,
>  tech_types.h and unittype_types.h. I don't know a way to avoid this.
>  - move functions which are called a lot out of foo.c and into
>  foo_inline.h. I just took the roughtly top 40 most called functions.
>  - allow the inlining of these functions if USE_INLINE is
>  defined. There is currently no support for this in configure or
>  makefiles. You have to specify it by hand. Make sure you also have at
>  least -O specified.
>  - move some functions to other files where they really belong. Saves
>  an include.
>  - demacrofy some of the macros of map.h
>  - inline some static functions.
> 
> TODO:
>  - add missing includes to the client files
>  - add some configure magic to discover the inline keyword the
>  compiler recognized.
>  - add a configure to enable/disable inlining
>  - since this is a first cut and focused on the dependency problems
>  and not so the performance increase I have just inlined the most
>  called functions. AFAIK there is no formal criteria which can be used
>  to determine if inling of this function is worth it. Only solution is
>  to perform the inline and test the performance. This may lead on
>  different CPU/platforms to different results.
> 
> <dream mode on>
> There is an automatic patch tester. You give this bot a tree and a
> list of patches. It will apply the patch, configure and build the code
> (using options you specify). It will then run N autogames based on a
> rc-template. It will measure the performance. This will be done for
> every patch and the stock tree. Extra points for comparing the
> savegames to the stock version. Extra points for measuring average and
> variance. More extra points for feeding the results through
> gnuplot. Extra points for fetching the stock tree from the CVS
> repository.
> 

I'll try and do some of this manually. A bit more detail on what you used would
be good to have. For example

1.) rc-template
2.) gcc version
3.) options for gnuplot
4.) CVS version
5.) kernel version is irrelevant correct?


> So I would just put some patched into the patches/ directory before I
> go to sleep and have a nice analysis the next morning. This will also
> allow an analysis which functions are worth inlining (DIR_CW for
> example isn't called in an autogame. Such automatic measurement will
> also give us a feeling what gains can be expected by inlining certain
> functions. I have currently no feeling for this.
> <dream mode off>
> 
> Results:
>  stock: 62.15s
>  with this patch and no inlining: 80.97s (difference because of
>  converting map_inx, dirstep,.. to functions)
>  with this patch and inlining: 40.46s
>  with this patch and inlining and NDEBUG: 36.83s
>  with this patch and inlining and -O3: 39.48s
> 

I seem to spot a missing

with this patch and inlining and -O3 and NDEBUG:

It would also be nice to have results for stock with -03 to compare with
patch and -03.

> Usage:
>  - unpack
>  - patch -p1 <inline1.diff
>  - make clean
>  - either 
>      make 

>    or 
>      make CPPFLAGS="-DUSE_INLINE"
> 
>       Raimar
> 
> -- 
>  email: rf13@xxxxxxxxxxxxxxxxx
>  "Reality? That's where the pizza delivery guy comes from!"


__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/


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