News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

compillation speed up in besch/vehikel_besch

Started by jk271, February 17, 2012, 04:01:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jk271

This patch does not add or remove any functionality.
It can speed up a little bit building process of game.

There are long functions in besch/vehicle_besch.h file now. (At least one is too long for header file in my opinion.) This header file is included in three files directly and in around twenty files indirectly (via another header file). Moving bodies of functions from .h file to .cc file removes unnecessary text processing.

I have measured time of build (several times)  and with patch it is about 0.5-0.6s faster than old version.

isidoro

The problem (I don't know about if these methods are critical in this aspect) is that if you take them away from the .h, they cannot be inlined by the compiler if it wishes to.  A very frequent inlined method can save a function call and be quicker in execution time.


jk271

#2
I had seen no "inline" modifier there so I had assumed that they had not been inline.

After reading your response I tried to look up more details about inline functions. I found that functions without "inline" modifier might be used as "inline" by compiler. I had not known that.

Thank you for highlighting such a behavior of function inlining.

It changes my assumption of no :"game performance change" to "performance change unknown". I did not realized significant performance decrease. Unfortunately I am not familiar with gprof yet to provide any figures.

prissi

Only get_bild_nr is called somewhat more frequently. But this was only 0.09 % of total time.

jk271

Thank you, prissi, for providing exact figures.