summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-05 10:33:25 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-05 10:33:25 +0200
commitc26a5932282b8757c3b60d20b1636971743d0235 (patch)
treecdd110f0fee3b295fa4de07932c59ff8e95d00f0
parentAnvilStats: added a profiling configuration (diff)
downloadcuberite-c26a5932282b8757c3b60d20b1636971743d0235.tar
cuberite-c26a5932282b8757c3b60d20b1636971743d0235.tar.gz
cuberite-c26a5932282b8757c3b60d20b1636971743d0235.tar.bz2
cuberite-c26a5932282b8757c3b60d20b1636971743d0235.tar.lz
cuberite-c26a5932282b8757c3b60d20b1636971743d0235.tar.xz
cuberite-c26a5932282b8757c3b60d20b1636971743d0235.tar.zst
cuberite-c26a5932282b8757c3b60d20b1636971743d0235.zip
-rw-r--r--AnvilStats/AnvilStats.vcproj24
-rw-r--r--source/WorldStorage/FastNBT.cpp8
2 files changed, 31 insertions, 1 deletions
diff --git a/AnvilStats/AnvilStats.vcproj b/AnvilStats/AnvilStats.vcproj
index 64fc47f85..168fba012 100644
--- a/AnvilStats/AnvilStats.vcproj
+++ b/AnvilStats/AnvilStats.vcproj
@@ -356,6 +356,30 @@
<File
RelativePath="..\source\WorldStorage\FastNBT.cpp"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="NBT_RESERVE_SIZE=10000"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="NBT_RESERVE_SIZE=10000"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release profiled|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="NBT_RESERVE_SIZE=10000"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\source\WorldStorage\FastNBT.h"
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));