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

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

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [RFC][Patch] Inline
From: Jason Short <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 21 Mar 2002 08:35:19 -0500

Raahul Kumar wrote:

I was requesting those numbers. It seems -03 is a fairly bad optimisation. Jason ran some tests on the stock freeciv, and he seemed to get large increases
in performance just by using NDEBUG. Jason, some comments on your previous
tests please?

With your patch and NDEBUG the speed increase is minor. Why?

Short answer: he gets these gains already in the patch.

When NDEBUG is defined, CHECK_MAP_POS is defined out and so is never called. CHECK_MAP_POS just calls is_normal_map_pos, which calls normalize_map_pos. Both of these are functions, so there is a substantial overhead to calling them [1]. This is the largest source of the difference between NDEBUG and !NDEBUG, though there are of course other assertions in there as well.

Raimar's patch seems to disable CHECK_MAP_POS entirely (which is not unreasonable, plan was to change CHECK_MAP_POS to only be used if DEBUG was defined before the release), so he'll get these benefits without NDEBUG. Even without this, though, is_normal_map_pos and normalize_map_pos are functions that should be inlined (currently only normalize_map_pos is AFAICT), so the overhead would be less in any case.

[1] Before anyone clamours for their removal: they have helped in tracking down a number of bugs and will probably help to track down many more.


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