summaryrefslogtreecommitdiffstats
path: root/src/Generating/BioGen.cpp
diff options
context:
space:
mode:
authorLukas Pioch <lukas@zgow.de>2014-11-05 21:58:21 +0100
committerLukas Pioch <lukas@zgow.de>2014-11-05 21:58:21 +0100
commit2915ef5bdbe24c247ec2b3b1fd28f80d2b244f27 (patch)
treeeed0f55673f86132bb6b91ab47c053b4aa3dee22 /src/Generating/BioGen.cpp
parentrenamed FindAndDoWithUUID to DoWithPlayerByUUID, fixed style and comments, added description to APIDump (diff)
parentMerge pull request #1587 from Ambushed91/WebAdmin (diff)
downloadcuberite-2915ef5bdbe24c247ec2b3b1fd28f80d2b244f27.tar
cuberite-2915ef5bdbe24c247ec2b3b1fd28f80d2b244f27.tar.gz
cuberite-2915ef5bdbe24c247ec2b3b1fd28f80d2b244f27.tar.bz2
cuberite-2915ef5bdbe24c247ec2b3b1fd28f80d2b244f27.tar.lz
cuberite-2915ef5bdbe24c247ec2b3b1fd28f80d2b244f27.tar.xz
cuberite-2915ef5bdbe24c247ec2b3b1fd28f80d2b244f27.tar.zst
cuberite-2915ef5bdbe24c247ec2b3b1fd28f80d2b244f27.zip
Diffstat (limited to 'src/Generating/BioGen.cpp')
-rw-r--r--src/Generating/BioGen.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp
index 0f2b0a73d..2a4dbe794 100644
--- a/src/Generating/BioGen.cpp
+++ b/src/Generating/BioGen.cpp
@@ -5,6 +5,8 @@
#include "Globals.h"
#include "BioGen.h"
+#include <chrono>
+#include <iostream>
#include "IntGen.h"
#include "ProtIntGen.h"
#include "../IniFile.h"
@@ -1199,3 +1201,51 @@ cBiomeGenPtr cBiomeGen::CreateBiomeGen(cIniFile & a_IniFile, int a_Seed, bool &
+
+////////////////////////////////////////////////////////////////////////////////
+// Performance tests:
+
+// Change to 1 to enable the perf test:
+#if 0
+
+class cBioGenPerfTest
+{
+public:
+ cBioGenPerfTest()
+ {
+ std::cout << "BioGen performance tests commencing, please wait..." << std::endl;
+ TestGen("MultiStepMap", std::make_unique<cBioGenMultiStepMap>(1).get());
+ TestGen("Grown", std::make_unique<cBioGenGrown>(1).get());
+ TestGen("GrownProt", std::make_unique<cBioGenProtGrown>(1).get());
+ std::cout << "BioGen performance tests complete." << std::endl;
+ }
+
+protected:
+ void TestGen(const AString && a_GenName, cBiomeGen * a_BioGen)
+ {
+ // Initialize the default settings for the generator:
+ cIniFile iniFile;
+ a_BioGen->InitializeBiomeGen(iniFile);
+
+ // Generate the biomes:
+ auto start = std::chrono::system_clock::now();
+ for (int z = 0; z < 100; z++)
+ {
+ for (int x = 0; x < 100; x++)
+ {
+ cChunkDef::BiomeMap biomes;
+ a_BioGen->GenBiomes(x, z, biomes);
+ } // for x
+ } // for z
+ auto dur = std::chrono::system_clock::now() - start;
+ double milliseconds = static_cast<double>((std::chrono::duration_cast<std::chrono::milliseconds>(dur)).count());
+
+ std::cout << a_GenName << ": " << 1000.0 * 100.0 * 100.0 / milliseconds << " chunks per second" << std::endl;
+ }
+} g_BioGenPerfTest;
+
+#endif
+
+
+
+