From 41fed27d0a45bd407e125e8fc805c46106573038 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 17 Aug 2023 15:45:03 +0100 Subject: [PATCH] Animated tile: Prefetch next item in map --- src/animated_tile.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/animated_tile.cpp b/src/animated_tile.cpp index 8f44022aa9..9b700252f3 100644 --- a/src/animated_tile.cpp +++ b/src/animated_tile.cpp @@ -17,6 +17,8 @@ #include "date_func.h" #include "3rdparty/cpp-btree/btree_map.h" +#include INCLUDE_FOR_PREFETCH_NTA + #include "safeguards.h" /** The table/list with animated tiles. */ @@ -109,6 +111,10 @@ void AnimateAnimatedTiles() continue; } + auto next = iter; + ++next; + if (next != _animated_tiles.end()) PREFETCH_NTA(&(next->second)); + if (iter->second.speed <= max_speed) { const TileIndex curr = iter->first; switch (GetTileType(curr)) { @@ -132,7 +138,7 @@ void AnimateAnimatedTiles() NOT_REACHED(); } } - ++iter; + iter = next; } }