summaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2015-04-04 01:33:34 +0200
committerest31 <MTest31@outlook.com>2015-04-05 09:25:46 +0200
commit334e70455b7f8a4607fe99dc12710d48169113a6 (patch)
treebc1612e206a14067280ae3fcc11340b14d747314 /src/server.cpp
parentfedbbc8883c1c8252fd8b40023687d953f93d10c (diff)
downloadminetest-334e70455b7f8a4607fe99dc12710d48169113a6.tar.gz
minetest-334e70455b7f8a4607fe99dc12710d48169113a6.tar.bz2
minetest-334e70455b7f8a4607fe99dc12710d48169113a6.zip
Crafting speedup
This greatly increases crafting performance, especially in worlds with many mods. Approved by @kwolekr. Introduces a hash-type-layered fall-through mechanism, where every layer specifies one hash algorithm, and the "deeper the fall", the more collisions to expect for the algorithm. One Craft definition only resides at one layer, which improves speed for lower layers (and a complete fail), due to most craft definitions residing at high layers. Due to the fall-through design, the undocumented behaviour that later craft recipes override older ones had to be weaked up a bit, but craft recipes with the same hash and layer will still override.
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 1969a5946..4971e6f66 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -334,6 +334,9 @@ Server::Server(
// Perform pending node name resolutions
m_nodedef->runNodeResolverCallbacks();
+ // init the recipe hashes to speed up crafting
+ m_craftdef->initHashes(this);
+
// Initialize Environment
m_env = new ServerEnvironment(servermap, m_script, this, m_path_world);