]> git.lizzy.rs Git - minetest.git/commit
Speed up the craft definition handling (#8097)
authorJozef Behran <jozuejozef@gmail.com>
Sun, 13 Jan 2019 14:11:47 +0000 (09:11 -0500)
committerLoïc Blot <nerzhul@users.noreply.github.com>
Sun, 13 Jan 2019 14:11:47 +0000 (15:11 +0100)
commita51909bb64811694773b6dd3abd791d3d78d85e6
tree76553f6cf3c685c292b00a898c8672df05d2b3a4
parent5a00b118959941722de977f2452f1e656c75304e
Speed up the craft definition handling (#8097)

The craft definition handling code that collects the names of
the craftable nodes suffers from vector reallocation
performance hits, slowing down instances with lots of
crafting recipes (VanessaE's DreamBuilder and most public
server some to my mind when thinking about this). As in each
instance the size of the resulting vector is already known,
add a reserve() call before the offending loops to allocate
the needed chunk of memory within the result vector in one
go, getting rid of the overhead.
src/craftdef.cpp