The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: Dwachs on April 13, 2020, 11:12:34 AM

Title: Patch: more cache-friendly data layout in convoi_t
Post by: Dwachs on April 13, 2020, 11:12:34 AM
Here is a patch that changes the data layout of convoi_t to be more cache-friendly for calls to sync_step and step: the most important data is moved to the front of the structure. Then most of them sits in one cache-line.
gperftools says that this improves the perfomance of these two methods.

Submit?
Title: Re: Patch: more cache-friendly data layout in convoi_t
Post by: prissi on April 14, 2020, 01:11:54 PM
Yes, please. It will depend on the compiler, but even if it only improved GCC it is worth submitting.
Title: Re: Patch: more cache-friendly data layout in convoi_t
Post by: Ters on April 15, 2020, 05:18:19 AM
The compilers have to conform to the same ABI in order to use the same system libraries. So GCC does things differently when compiling for Windows and Linux. One difference has to do with bit-fields. So it might be more platform dependent in practice. (Even more so for different hardware, but that is a bigger challenge to overcome.)
Title: Re: Patch: more cache-friendly data layout in convoi_t
Post by: prissi on April 21, 2020, 01:59:37 PM
Again, please submit.
Title: Re: Patch: more cache-friendly data layout in convoi_t
Post by: Dwachs on April 21, 2020, 05:42:38 PM
It is, see r9028
Title: Re: Patch: more cache-friendly data layout in convoi_t
Post by: prissi on April 22, 2020, 01:11:55 PM
Ups, thanks.