From c26a5932282b8757c3b60d20b1636971743d0235 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Fri, 5 Oct 2012 08:33:25 +0000 Subject: AnvilStats: made FastNBT faster by tweaking the pre-allocation. Although the file is shared between AnvilStats and MCServer, MCServer doesn't use this tweak (it uses too much memory) git-svn-id: http://mc-server.googlecode.com/svn/trunk@931 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/WorldStorage/FastNBT.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source/WorldStorage') diff --git a/source/WorldStorage/FastNBT.cpp b/source/WorldStorage/FastNBT.cpp index 773aecf62..13a6819e1 100644 --- a/source/WorldStorage/FastNBT.cpp +++ b/source/WorldStorage/FastNBT.cpp @@ -10,6 +10,12 @@ +// The number of NBT tags that are reserved when an NBT parsing is started. +// You can override this by using a cmdline define +#ifndef NBT_RESERVE_SIZE + #define NBT_RESERVE_SIZE 200 +#endif // NBT_RESERVE_SIZE + #define RETURN_FALSE_IF_FALSE(X) do { if (!X) return false; } while (0) @@ -54,7 +60,7 @@ bool cParsedNBT::Parse(void) return false; } - m_Tags.reserve(200); + m_Tags.reserve(NBT_RESERVE_SIZE); m_Tags.push_back(cFastNBTTag(TAG_Compound, -1)); -- cgit v1.2.3