From 25cc5d1a3263aaca46f77f64b6cc20b1d2c32cac Mon Sep 17 00:00:00 2001 From: Lars Hofhansl Date: Sat, 21 Jul 2018 03:07:43 -0700 Subject: Optimize ABM checks. See #7555 Cache (up to 64) node types for each active block. Check this cache first to see whether any ABM needs to be triggered for a block. --- src/mapblock.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/mapblock.h') diff --git a/src/mapblock.h b/src/mapblock.h index 00695a94e..6b5015cab 100644 --- a/src/mapblock.h +++ b/src/mapblock.h @@ -114,6 +114,8 @@ public: } else if (mod == m_modified) { m_modified_reason |= reason; } + if (mod == MOD_STATE_WRITE_NEEDED) + contents_cached = false; } inline u32 getModified() @@ -529,6 +531,14 @@ public: static const u32 nodecount = MAP_BLOCKSIZE * MAP_BLOCKSIZE * MAP_BLOCKSIZE; + //// ABM optimizations //// + // Cache of content types + std::unordered_set contents; + // True if content types are cached + bool contents_cached = false; + // True if we never want to cache content types for this block + bool do_not_cache_contents = false; + private: /* Private member variables -- cgit v1.2.3