diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2017-02-26 18:58:25 -0500 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2017-02-26 18:58:25 -0500 |
commit | f4c47aa1845e996dea89ed17c2d71752df50ed50 (patch) | |
tree | 735b09c57119f58641243a212833c244324fd9c6 /xtest.cpp | |
parent | 7be6cc9a3ec6aaf818a24ad97201a4d1e67e6586 (diff) |
reorginization
Diffstat (limited to 'xtest.cpp')
-rw-r--r-- | xtest.cpp | 174 |
1 files changed, 0 insertions, 174 deletions
diff --git a/xtest.cpp b/xtest.cpp deleted file mode 100644 index 2f814c5..0000000 --- a/xtest.cpp +++ /dev/null @@ -1,174 +0,0 @@ -#include <string> -#include <vector> -#include <thread> -#include <memory> - -#define BENCHPRESS_CONFIG_MAIN -#include "benchpress.hpp" - -#include <entityx/entityx.h> - -#include "EntityXBenchmark.h" - -inline void init_entities(entityx::EntityManager& entities, size_t nentities){ - for (size_t i = 0; i < nentities; i++) { - auto entity = entities.create(); - - entity.assign<EntityXBenchmark::PositionComponent>(); - entity.assign<EntityXBenchmark::DirectionComponent>(); - - if (i % 2) { - entity.assign<EntityXBenchmark::ComflabulationComponent>(); - } - } -} - -inline void runEntitiesSystemsEntityXBenchmark(benchpress::context* ctx, size_t nentities) { - EntityXBenchmark::Application app; - auto& entities = app.entities; - - init_entities(entities, nentities); - - ctx->reset_timer(); - for (size_t i = 0; i < ctx->num_iterations(); ++i) { - app.update(EntityXBenchmark::fakeDeltaTime); - } -} - - - - -BENCHMARK("entityx create destroy entity with components", [](benchpress::context* ctx) { - entityx::EntityX app; - auto& entities = app.entities; - - ctx->reset_timer(); - for (size_t i = 0; i < ctx->num_iterations(); ++i) { - auto entity = entities.create(); - - entity.assign<EntityXBenchmark::PositionComponent>(); - entity.assign<EntityXBenchmark::DirectionComponent>(); - entity.assign<EntityXBenchmark::ComflabulationComponent>(); - - entity.destroy(); - } -}) - - - - - -class BenchmarksEntityX { - public: - static const std::vector<int> ENTITIES; - - static inline void makeBenchmarks(std::string name) { - makeBenchmarks(name, ENTITIES); - } - - static void makeBenchmarks(std::string name, const std::vector<int>& entities) { - for(int nentities : entities) { - std::string tag = "[" + std::to_string(nentities) + "]"; - - std::stringstream ss; - ss << std::right << std::setw(10) << tag << ' '; - ss << name << ' '; - ss << std::right << std::setw(8) << nentities; - ss << " entities component systems update"; - - std::string benchmark_name = ss.str(); - BENCHMARK(benchmark_name, [nentities](benchpress::context* ctx) { - runEntitiesSystemsEntityXBenchmark(ctx, nentities); - }) - } - } - - BenchmarksEntityX(std::string name){ - makeBenchmarks(name); - } -}; -const std::vector<int> BenchmarksEntityX::ENTITIES = { - 25, 50, - 100, 200, 400, 800, - 1600, 3200, 5000, - 10'000, 30'000, - 100'000, 500'000, - 1'000'000, 2'000'000 -}; - -BenchmarksEntityX entityxbenchmarks ("entityx"); - - - - - -/* -BENCHMARK("[25] entityx 25 entities component systems update", [](benchpress::context* ctx) { - runEntitiesSystemsEntityXBenchmark(ctx, 25); -}) - -BENCHMARK("[50] entityx 50 entities component systems update", [](benchpress::context* ctx) { - runEntitiesSystemsEntityXBenchmark(ctx, 50); -}) - -BENCHMARK("[100] entityx 100 entities component systems update", [](benchpress::context* ctx) { - runEntitiesSystemsEntityXBenchmark(ctx, 100); -}) - -BENCHMARK("[200] entityx 200 entities component systems update", [](benchpress::context* ctx) { - runEntitiesSystemsEntityXBenchmark(ctx, 200); -}) - - -BENCHMARK("[400] entityx 400 entities component systems update", [](benchpress::context* ctx) { - runEntitiesSystemsEntityXBenchmark(ctx, 400); -}) - - -BENCHMARK("[800] entityx 800 entities component systems update", [](benchpress::context* ctx) { - runEntitiesSystemsEntityXBenchmark(ctx, 800); -}) - - -BENCHMARK("[1600] entityx 1600 entities component systems update", [](benchpress::context* ctx) { - runEntitiesSystemsEntityXBenchmark(ctx, 1600); -}) - - - -BENCHMARK("[3200] entityx 3200 entities component systems update", [](benchpress::context* ctx) { - runEntitiesSystemsEntityXBenchmark(ctx, 3200); -}) - - -BENCHMARK("[5000] entityx 5000 entities component systems update", [](benchpress::context* ctx) { - runEntitiesSystemsEntityXBenchmark(ctx, 5000); -}) - - -BENCHMARK("[10000] entityx 10000 entities component systems update", [](benchpress::context* ctx) { - runEntitiesSystemsEntityXBenchmark(ctx, 10'000); -}) - -BENCHMARK("[30000] entityx 30000 entities component systems update", [](benchpress::context* ctx) { - runEntitiesSystemsEntityXBenchmark(ctx, 30'000); -}) - - -BENCHMARK("[100000] entityx 100000 entities component systems update", [](benchpress::context* ctx) { - runEntitiesSystemsEntityXBenchmark(ctx, 100'000L); -}) - - -BENCHMARK("[500000] entityx 500000 entities component systems update", [](benchpress::context* ctx) { - runEntitiesSystemsEntityXBenchmark(ctx, 500'000L); -}) - -BENCHMARK("[1000000] entityx 1M entities component systems update", [](benchpress::context* ctx) { - runEntitiesSystemsEntityXBenchmark(ctx, 1'000'000L); -}) - -BENCHMARK("[2000000] entityx 2M entities component systems update", [](benchpress::context* ctx) { - runEntitiesSystemsEntityXBenchmark(ctx, 2'000'000L); -}) -*/ |