Patch: Train Collision Cache
stillunknown created an awesome patch which reduces the CPU usage quite a bit. The idea is to reduce the train collision checks with a sort of cache instead of a an on-going loop (details @ tt-forums).
Tonight we did some tests how this patch affects the game and it is quite impressing. I don’t want to say this is was a real performance test, but we checked the CPU load with a patched and an unpatched version of OpenTTD (r10048). My local machine was used as the server (PPC G5 2GHz) and as references we used Public Server Game #09 and Game #34.
The Results (vary with network layout, amount of trains and so on):
cpu usage in percent
Game#34: w/o patch: ~45%; patched: ~40% (~700 trains)
Game#09: w/o patch: ~67%; patched: ~50% (~1300 trains)
Especially games with a big mainline loop profit from this great patch.
Did some tests on XP with w32 port builds 10048 and 10048M (build provided by Xeryus) And here are the load decrease from original to patched –
Client:
Game#34: ~30-40% to ~12-20% (~700 trains)
Express vs Local: 100% to ~50% (~600 trains)
Game#09: 100% to ~50% (~1400 trains)
Server:
Game#34: ~15% to 10-12%
E vs L: ~55 to ~25-30%
Game#09: ~70 to ~25%
Differences between these games arefollowing. #34 is a game with high number of train / medium amount of tracks, E vs L – high trains / high tracks, #09 ultra high trains / high tracks. Basicaly, benefit increases with amount of trains AND size of network/amount of junctions.
Well done stillunknown!
I made a performance meter that displays game ticks / second.
http://www.tt-forums.net/viewtopic.php?p=594775#594775
Local copy:
Without cache: 43.4 ticks/second
With cache: 71.4 ticks/second
Difference: 64.5% faster
Did some testing with another patch (hash optimization) and here are results:
Game#09:
10048 ~70%
10048 + stillunknown’s patch ~25%
10104 + peter’s patch ~15%
Game#34: ~15% to 10-12%
10048 ~15%
10048 + stillunknown’s patch 10-12%
10104 + peter’s patch ~5%
E vs L:
10048 ~55%
10048 + stillunknown’s patch 25-30%
10104 + peter’s patch ~4%
must say – I like new numbers very much