Cleanup Benchmarks
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 42s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 28s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 1m5s
Bigfoot / Sonarqube (push) Skipped
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 41s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 25s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 52s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m14s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 55s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 43s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 28s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 46s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 31s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 1m13s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 55s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m18s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 1m0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 33s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 26s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 53s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 42s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 51s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 44s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 55s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 47s
Bigfoot / Clang Format Checks (push) Successful in 10s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 42s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 28s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 1m5s
Bigfoot / Sonarqube (push) Skipped
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 41s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 25s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 52s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m14s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 55s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 43s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 28s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 46s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 31s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 1m13s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 55s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m18s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 1m0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Successful in 33s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Successful in 26s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 53s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Successful in 42s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 51s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Successful in 44s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 55s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 47s
Bigfoot / Clang Format Checks (push) Successful in 10s
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
#include <AssetsForBenchmarking/Asset/BenchmarkAssetReferred.hpp>
|
#include <AssetsForBenchmarking/Asset/BenchmarkAssetReferred.hpp>
|
||||||
|
|
||||||
#include <EASTL/optional.h>
|
#include <EASTL/optional.h>
|
||||||
|
#include <EASTL/span.h>
|
||||||
#include <EASTL/vector.h>
|
#include <EASTL/vector.h>
|
||||||
#include <benchmark/benchmark.h>
|
#include <benchmark/benchmark.h>
|
||||||
#include <effolkronium/random.hpp>
|
#include <effolkronium/random.hpp>
|
||||||
@@ -34,18 +35,17 @@ class BigFileFixture: public benchmark::Fixture
|
|||||||
static constexpr std::uint32_t REFS_PER_ASSET = 4;
|
static constexpr std::uint32_t REFS_PER_ASSET = 4;
|
||||||
static constexpr std::size_t ASSET_PAYLOAD_SIZE = 256;
|
static constexpr std::size_t ASSET_PAYLOAD_SIZE = 256;
|
||||||
|
|
||||||
void SetUp(benchmark::State&) override
|
void SetUp([[maybe_unused]] benchmark::State& p_state) override
|
||||||
{
|
{
|
||||||
// The DB is populated exactly once for the entire benchmark process.
|
// The DB is populated exactly once for the entire benchmark process.
|
||||||
// SetUp is called before every calibration round (Google Benchmark doubles
|
// SetUp is called before every calibration round (Google Benchmark doubles
|
||||||
// iteration counts until it reaches a stable measurement), so rebuilding
|
// iteration counts until it reaches a stable measurement), so rebuilding
|
||||||
// the DB each time would dominate the total benchmark time.
|
// the DB each time would dominate the total benchmark time.
|
||||||
static const eastl::vector<UUID> s_uuids = BuildData();
|
m_uuids = BuildData();
|
||||||
m_uuids = &s_uuids;
|
|
||||||
m_bigFile.emplace(File {BIGFILE_ENGINEBENCHMARKS_LOCATION});
|
m_bigFile.emplace(File {BIGFILE_ENGINEBENCHMARKS_LOCATION});
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown(benchmark::State&) override
|
void TearDown([[maybe_unused]] benchmark::State& p_state) override
|
||||||
{
|
{
|
||||||
m_bigFile.reset();
|
m_bigFile.reset();
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ class BigFileFixture: public benchmark::Fixture
|
|||||||
batch.reserve(p_batchSize);
|
batch.reserve(p_batchSize);
|
||||||
for (std::size_t i = 0; i < p_batchSize; ++i)
|
for (std::size_t i = 0; i < p_batchSize; ++i)
|
||||||
{
|
{
|
||||||
batch.push_back((*m_uuids)[Random::get<std::size_t>(0, m_uuids->size() - 1)]);
|
batch.push_back(m_uuids[Random::get<std::size_t>(0, m_uuids.size() - 1)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return batch;
|
return batch;
|
||||||
@@ -78,42 +78,47 @@ class BigFileFixture: public benchmark::Fixture
|
|||||||
}
|
}
|
||||||
|
|
||||||
eastl::optional<BigFile> m_bigFile;
|
eastl::optional<BigFile> m_bigFile;
|
||||||
const eastl::vector<UUID>* m_uuids = nullptr;
|
eastl::span<const UUID> m_uuids;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static eastl::vector<UUID> BuildData()
|
static const eastl::vector<UUID>& BuildData()
|
||||||
{
|
{
|
||||||
eastl::vector<UUID> uuids;
|
static const eastl::vector<UUID> s_uuids = []()
|
||||||
eastl::vector<eastl::vector<std::byte>> flatbuffers;
|
|
||||||
eastl::vector<eastl::vector<UUID>> hardReferences;
|
|
||||||
uuids.reserve(ASSET_COUNT);
|
|
||||||
flatbuffers.reserve(ASSET_COUNT);
|
|
||||||
hardReferences.reserve(ASSET_COUNT);
|
|
||||||
|
|
||||||
for (std::uint32_t i = 0; i < ASSET_COUNT; ++i)
|
|
||||||
{
|
{
|
||||||
BenchmarkAsset asset;
|
eastl::vector<UUID> uuids;
|
||||||
asset.SetName(asset.GetHeader().uuid.ToString().c_str());
|
eastl::vector<eastl::vector<std::byte>> flatbuffers;
|
||||||
asset.GetAsset().payload.assign(ASSET_PAYLOAD_SIZE, std::uint8_t {0xAB});
|
eastl::vector<eastl::vector<UUID>> hardReferences;
|
||||||
for (std::uint32_t j = 0; j < REFS_PER_ASSET; ++j)
|
uuids.reserve(ASSET_COUNT);
|
||||||
{
|
flatbuffers.reserve(ASSET_COUNT);
|
||||||
BenchmarkAssetReferred assetReferred;
|
hardReferences.reserve(ASSET_COUNT);
|
||||||
assetReferred.SetName(assetReferred.GetHeader().uuid.ToString().c_str());
|
|
||||||
|
|
||||||
asset.GetAsset().refs.emplace_back(assetReferred.GetHeader().uuid);
|
for (std::uint32_t i = 0; i < ASSET_COUNT; ++i)
|
||||||
|
{
|
||||||
|
BenchmarkAsset asset;
|
||||||
|
asset.SetName(asset.GetHeader().uuid.ToString().c_str());
|
||||||
|
asset.GetAsset().payload.assign(ASSET_PAYLOAD_SIZE, std::uint8_t {0xAB});
|
||||||
|
for (std::uint32_t j = 0; j < REFS_PER_ASSET; ++j)
|
||||||
|
{
|
||||||
|
BenchmarkAssetReferred assetReferred;
|
||||||
|
assetReferred.SetName(assetReferred.GetHeader().uuid.ToString().c_str());
|
||||||
|
|
||||||
|
asset.GetAsset().refs.emplace_back(assetReferred.GetHeader().uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
eastl::vector<std::byte> flatbuffer = asset.Pack();
|
||||||
|
hardReferences.push_back(asset.GetHardReferences(flatbuffer));
|
||||||
|
flatbuffers.push_back(std::move(flatbuffer));
|
||||||
|
uuids.push_back(asset.GetHeader().uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
eastl::vector<std::byte> flatbuffer = asset.Pack();
|
BigFile bigFile {File {BIGFILE_ENGINEBENCHMARKS_LOCATION}};
|
||||||
hardReferences.push_back(asset.GetHardReferences(flatbuffer));
|
bigFile.Clear();
|
||||||
flatbuffers.push_back(std::move(flatbuffer));
|
bigFile.SaveAssetFlatbuffers(uuids, flatbuffers, hardReferences);
|
||||||
uuids.push_back(asset.GetHeader().uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
BigFile bigFile {File {BIGFILE_ENGINEBENCHMARKS_LOCATION}};
|
return uuids;
|
||||||
bigFile.Clear();
|
}();
|
||||||
bigFile.SaveAssetFlatbuffers(uuids, flatbuffers, hardReferences);
|
|
||||||
|
|
||||||
return uuids;
|
return s_uuids;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -126,7 +131,7 @@ BENCHMARK_DEFINE_F(BigFileFixture, GetAssetFlatbuffer)(benchmark::State& state)
|
|||||||
for (auto _: state)
|
for (auto _: state)
|
||||||
{
|
{
|
||||||
eastl::vector<std::byte> flatbuffer = m_bigFile->GetAssetFlatbuffer(
|
eastl::vector<std::byte> flatbuffer = m_bigFile->GetAssetFlatbuffer(
|
||||||
(*m_uuids)[Random::get<std::size_t>(0, m_uuids->size() - 1)]);
|
m_uuids[Random::get<std::size_t>(0, m_uuids.size() - 1)]);
|
||||||
benchmark::DoNotOptimize(flatbuffer);
|
benchmark::DoNotOptimize(flatbuffer);
|
||||||
|
|
||||||
bytesProcessed += static_cast<std::int64_t>(flatbuffer.size());
|
bytesProcessed += static_cast<std::int64_t>(flatbuffer.size());
|
||||||
@@ -183,10 +188,11 @@ BENCHMARK_DEFINE_F(BigFileFixture, GetAssetHardReferences)(benchmark::State& sta
|
|||||||
for (auto _: state)
|
for (auto _: state)
|
||||||
{
|
{
|
||||||
benchmark::DoNotOptimize(
|
benchmark::DoNotOptimize(
|
||||||
m_bigFile->GetAssetHardReferences((*m_uuids)[Random::get<std::size_t>(0, m_uuids->size() - 1)]));
|
m_bigFile->GetAssetHardReferences(m_uuids[Random::get<std::size_t>(0, m_uuids.size() - 1)]));
|
||||||
}
|
}
|
||||||
|
|
||||||
state.SetItemsProcessed(state.iterations());
|
state.SetItemsProcessed(state.iterations());
|
||||||
|
state.SetBytesProcessed(static_cast<std::int64_t>(state.iterations()) * REFS_PER_ASSET * UUID::UUID_BYTE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
BENCHMARK_REGISTER_F(BigFileFixture, GetAssetHardReferences)->Name("BigFile/GetAssetHardReferences")->UseRealTime();
|
BENCHMARK_REGISTER_F(BigFileFixture, GetAssetHardReferences)->Name("BigFile/GetAssetHardReferences")->UseRealTime();
|
||||||
@@ -208,6 +214,8 @@ BENCHMARK_DEFINE_F(BigFileFixture, GetAssetsHardReferences)(benchmark::State& st
|
|||||||
}
|
}
|
||||||
|
|
||||||
state.SetItemsProcessed(state.iterations() * batchSize);
|
state.SetItemsProcessed(state.iterations() * batchSize);
|
||||||
|
state.SetBytesProcessed(static_cast<std::int64_t>(state.iterations()) * batchSize * REFS_PER_ASSET *
|
||||||
|
UUID::UUID_BYTE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
BENCHMARK_REGISTER_F(BigFileFixture, GetAssetsHardReferences)
|
BENCHMARK_REGISTER_F(BigFileFixture, GetAssetsHardReferences)
|
||||||
@@ -231,6 +239,10 @@ BENCHMARK_DEFINE_F(BigFileFixture, SaveAssetFlatbuffer)(benchmark::State& state)
|
|||||||
BenchmarkAsset asset;
|
BenchmarkAsset asset;
|
||||||
asset.SetName(asset.GetHeader().uuid.ToString().c_str());
|
asset.SetName(asset.GetHeader().uuid.ToString().c_str());
|
||||||
asset.GetAsset().payload.assign(ASSET_PAYLOAD_SIZE, std::uint8_t {0xAB});
|
asset.GetAsset().payload.assign(ASSET_PAYLOAD_SIZE, std::uint8_t {0xAB});
|
||||||
|
for (std::uint32_t j = 0; j < REFS_PER_ASSET; ++j)
|
||||||
|
{
|
||||||
|
asset.GetAsset().refs.emplace_back(m_uuids[Random::get<std::size_t>(0, m_uuids.size() - 1)]);
|
||||||
|
}
|
||||||
|
|
||||||
const eastl::vector<std::byte> flatbuffer = asset.Pack();
|
const eastl::vector<std::byte> flatbuffer = asset.Pack();
|
||||||
const eastl::vector<UUID> hardReferences = asset.GetHardReferences(flatbuffer);
|
const eastl::vector<UUID> hardReferences = asset.GetHardReferences(flatbuffer);
|
||||||
@@ -268,6 +280,10 @@ BENCHMARK_DEFINE_F(BigFileFixture, SaveAssetFlatbuffers)(benchmark::State& state
|
|||||||
BenchmarkAsset asset;
|
BenchmarkAsset asset;
|
||||||
asset.SetName(asset.GetHeader().uuid.ToString().c_str());
|
asset.SetName(asset.GetHeader().uuid.ToString().c_str());
|
||||||
asset.GetAsset().payload.assign(ASSET_PAYLOAD_SIZE, std::uint8_t {0xAB});
|
asset.GetAsset().payload.assign(ASSET_PAYLOAD_SIZE, std::uint8_t {0xAB});
|
||||||
|
for (std::uint32_t j = 0; j < REFS_PER_ASSET; ++j)
|
||||||
|
{
|
||||||
|
asset.GetAsset().refs.emplace_back(m_uuids[Random::get<std::size_t>(0, m_uuids.size() - 1)]);
|
||||||
|
}
|
||||||
|
|
||||||
eastl::vector<std::byte> flatbuffer = asset.Pack();
|
eastl::vector<std::byte> flatbuffer = asset.Pack();
|
||||||
uuids.push_back(asset.GetHeader().uuid);
|
uuids.push_back(asset.GetHeader().uuid);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include <AssetsForBenchmarking/Asset/BenchmarkAssetReferred.hpp>
|
#include <AssetsForBenchmarking/Asset/BenchmarkAssetReferred.hpp>
|
||||||
|
|
||||||
#include <EASTL/optional.h>
|
#include <EASTL/optional.h>
|
||||||
|
#include <EASTL/span.h>
|
||||||
#include <EASTL/vector.h>
|
#include <EASTL/vector.h>
|
||||||
#include <benchmark/benchmark.h>
|
#include <benchmark/benchmark.h>
|
||||||
#include <effolkronium/random.hpp>
|
#include <effolkronium/random.hpp>
|
||||||
@@ -40,12 +41,11 @@ class SasquatchFixture: public benchmark::Fixture
|
|||||||
// SetUp is called before every calibration round (Google Benchmark doubles
|
// SetUp is called before every calibration round (Google Benchmark doubles
|
||||||
// iteration counts until it reaches a stable measurement), so rebuilding
|
// iteration counts until it reaches a stable measurement), so rebuilding
|
||||||
// the file each time would dominate the total benchmark time.
|
// the file each time would dominate the total benchmark time.
|
||||||
static const eastl::vector<UUID> s_uuids = BuildData();
|
m_uuids = BuildData();
|
||||||
m_uuids = &s_uuids;
|
|
||||||
m_sasquatch.emplace(File {SASQUATCH_ENGINEBENCHMARKS_LOCATION});
|
m_sasquatch.emplace(File {SASQUATCH_ENGINEBENCHMARKS_LOCATION});
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown(benchmark::State&) override
|
void TearDown([[maybe_unused]] benchmark::State& p_state) override
|
||||||
{
|
{
|
||||||
m_sasquatch.reset();
|
m_sasquatch.reset();
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ class SasquatchFixture: public benchmark::Fixture
|
|||||||
batch.reserve(p_batchSize);
|
batch.reserve(p_batchSize);
|
||||||
for (std::size_t i = 0; i < p_batchSize; ++i)
|
for (std::size_t i = 0; i < p_batchSize; ++i)
|
||||||
{
|
{
|
||||||
batch.push_back((*m_uuids)[Random::get<std::size_t>(0, m_uuids->size() - 1)]);
|
batch.push_back(m_uuids[Random::get<std::size_t>(0, m_uuids.size() - 1)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return batch;
|
return batch;
|
||||||
@@ -78,57 +78,62 @@ class SasquatchFixture: public benchmark::Fixture
|
|||||||
}
|
}
|
||||||
|
|
||||||
eastl::optional<Sasquatch> m_sasquatch;
|
eastl::optional<Sasquatch> m_sasquatch;
|
||||||
const eastl::vector<UUID>* m_uuids = nullptr;
|
eastl::span<const UUID> m_uuids;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static eastl::vector<UUID> BuildData()
|
static const eastl::vector<UUID>& BuildData()
|
||||||
{
|
{
|
||||||
File {SASQUATCH_ENGINEBENCHMARKS_LOCATION}.Delete();
|
static const eastl::vector<UUID> s_uuids = []()
|
||||||
|
|
||||||
eastl::vector<UUID> uuids;
|
|
||||||
eastl::vector<eastl::vector<std::byte>> flatbuffers;
|
|
||||||
eastl::vector<eastl::vector<UUID>> hardReferences;
|
|
||||||
uuids.reserve(ASSET_COUNT);
|
|
||||||
flatbuffers.reserve(ASSET_COUNT);
|
|
||||||
hardReferences.reserve(ASSET_COUNT);
|
|
||||||
|
|
||||||
for (std::uint32_t i = 0; i < ASSET_COUNT; ++i)
|
|
||||||
{
|
{
|
||||||
BenchmarkAsset asset;
|
File {SASQUATCH_ENGINEBENCHMARKS_LOCATION}.Delete();
|
||||||
asset.SetName(asset.GetHeader().uuid.ToString().c_str());
|
|
||||||
asset.GetAsset().payload.assign(ASSET_PAYLOAD_SIZE, std::uint8_t {0xAB});
|
|
||||||
for (std::uint32_t j = 0; j < REFS_PER_ASSET; ++j)
|
|
||||||
{
|
|
||||||
BenchmarkAssetReferred assetReferred;
|
|
||||||
assetReferred.SetName(assetReferred.GetHeader().uuid.ToString().c_str());
|
|
||||||
|
|
||||||
asset.GetAsset().refs.emplace_back(assetReferred.GetHeader().uuid);
|
eastl::vector<UUID> uuids;
|
||||||
|
eastl::vector<eastl::vector<std::byte>> flatbuffers;
|
||||||
|
eastl::vector<eastl::vector<UUID>> hardReferences;
|
||||||
|
uuids.reserve(ASSET_COUNT);
|
||||||
|
flatbuffers.reserve(ASSET_COUNT);
|
||||||
|
hardReferences.reserve(ASSET_COUNT);
|
||||||
|
|
||||||
|
for (std::uint32_t i = 0; i < ASSET_COUNT; ++i)
|
||||||
|
{
|
||||||
|
BenchmarkAsset asset;
|
||||||
|
asset.SetName(asset.GetHeader().uuid.ToString().c_str());
|
||||||
|
asset.GetAsset().payload.assign(ASSET_PAYLOAD_SIZE, std::uint8_t {0xAB});
|
||||||
|
for (std::uint32_t j = 0; j < REFS_PER_ASSET; ++j)
|
||||||
|
{
|
||||||
|
BenchmarkAssetReferred assetReferred;
|
||||||
|
assetReferred.SetName(assetReferred.GetHeader().uuid.ToString().c_str());
|
||||||
|
|
||||||
|
asset.GetAsset().refs.emplace_back(assetReferred.GetHeader().uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
eastl::vector<std::byte> flatbuffer = asset.Pack();
|
||||||
|
hardReferences.push_back(asset.GetHardReferences(flatbuffer));
|
||||||
|
flatbuffers.push_back(std::move(flatbuffer));
|
||||||
|
uuids.push_back(asset.GetHeader().uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
eastl::vector<std::byte> flatbuffer = asset.Pack();
|
std::size_t totalFlatbufferBytes = 0;
|
||||||
hardReferences.push_back(asset.GetHardReferences(flatbuffer));
|
std::size_t totalHardReferencesBytes = 0;
|
||||||
flatbuffers.push_back(std::move(flatbuffer));
|
for (std::size_t i = 0; i < uuids.size(); ++i)
|
||||||
uuids.push_back(asset.GetHeader().uuid);
|
{
|
||||||
}
|
totalFlatbufferBytes += flatbuffers[i].size();
|
||||||
|
totalHardReferencesBytes += hardReferences[i].size() * UUID::UUID_BYTE_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
std::size_t totalFlatbufferBytes = 0;
|
SasquatchWriter writer {File {SASQUATCH_ENGINEBENCHMARKS_LOCATION},
|
||||||
std::size_t totalHardReferencesBytes = 0;
|
uuids.size(),
|
||||||
for (std::size_t i = 0; i < uuids.size(); ++i)
|
totalFlatbufferBytes,
|
||||||
{
|
totalHardReferencesBytes};
|
||||||
totalFlatbufferBytes += flatbuffers[i].size();
|
for (std::size_t i = 0; i < uuids.size(); ++i)
|
||||||
totalHardReferencesBytes += hardReferences[i].size() * UUID::UUID_BYTE_SIZE;
|
{
|
||||||
}
|
writer.WriteAsset(uuids[i], flatbuffers[i], hardReferences[i]);
|
||||||
|
}
|
||||||
|
|
||||||
SasquatchWriter writer {File {SASQUATCH_ENGINEBENCHMARKS_LOCATION},
|
return uuids;
|
||||||
uuids.size(),
|
}();
|
||||||
totalFlatbufferBytes,
|
|
||||||
totalHardReferencesBytes};
|
|
||||||
for (std::size_t i = 0; i < uuids.size(); ++i)
|
|
||||||
{
|
|
||||||
writer.WriteAsset(uuids[i], flatbuffers[i], hardReferences[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return uuids;
|
return s_uuids;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -139,10 +144,11 @@ BENCHMARK_DEFINE_F(SasquatchFixture, GetAssetHardReferences)(benchmark::State& s
|
|||||||
for (auto _: state)
|
for (auto _: state)
|
||||||
{
|
{
|
||||||
benchmark::DoNotOptimize(
|
benchmark::DoNotOptimize(
|
||||||
m_sasquatch->GetAssetHardReferences((*m_uuids)[Random::get<std::size_t>(0, m_uuids->size() - 1)]));
|
m_sasquatch->GetAssetHardReferences(m_uuids[Random::get<std::size_t>(0, m_uuids.size() - 1)]));
|
||||||
}
|
}
|
||||||
|
|
||||||
state.SetItemsProcessed(state.iterations());
|
state.SetItemsProcessed(state.iterations());
|
||||||
|
state.SetBytesProcessed(static_cast<std::int64_t>(state.iterations()) * REFS_PER_ASSET * UUID::UUID_BYTE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
BENCHMARK_REGISTER_F(SasquatchFixture, GetAssetHardReferences)->Name("Sasquatch/GetAssetHardReferences")->UseRealTime();
|
BENCHMARK_REGISTER_F(SasquatchFixture, GetAssetHardReferences)->Name("Sasquatch/GetAssetHardReferences")->UseRealTime();
|
||||||
@@ -164,6 +170,8 @@ BENCHMARK_DEFINE_F(SasquatchFixture, GetAssetsHardReferences)(benchmark::State&
|
|||||||
}
|
}
|
||||||
|
|
||||||
state.SetItemsProcessed(state.iterations() * batchSize);
|
state.SetItemsProcessed(state.iterations() * batchSize);
|
||||||
|
state.SetBytesProcessed(static_cast<std::int64_t>(state.iterations()) * batchSize * REFS_PER_ASSET *
|
||||||
|
UUID::UUID_BYTE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
BENCHMARK_REGISTER_F(SasquatchFixture, GetAssetsHardReferences)
|
BENCHMARK_REGISTER_F(SasquatchFixture, GetAssetsHardReferences)
|
||||||
@@ -184,7 +192,7 @@ BENCHMARK_DEFINE_F(SasquatchFixture, GetAssetFlatbuffer)(benchmark::State& state
|
|||||||
for (auto _: state)
|
for (auto _: state)
|
||||||
{
|
{
|
||||||
eastl::vector<std::byte> flatbuffer = m_sasquatch->GetAssetFlatbuffer(
|
eastl::vector<std::byte> flatbuffer = m_sasquatch->GetAssetFlatbuffer(
|
||||||
(*m_uuids)[Random::get<std::size_t>(0, m_uuids->size() - 1)]);
|
m_uuids[Random::get<std::size_t>(0, m_uuids.size() - 1)]);
|
||||||
benchmark::DoNotOptimize(flatbuffer);
|
benchmark::DoNotOptimize(flatbuffer);
|
||||||
|
|
||||||
bytesProcessed += static_cast<std::int64_t>(flatbuffer.size());
|
bytesProcessed += static_cast<std::int64_t>(flatbuffer.size());
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <AssetsForBenchmarking/Asset/BenchmarkAssetReferred.hpp>
|
#include <AssetsForBenchmarking/Asset/BenchmarkAssetReferred.hpp>
|
||||||
|
|
||||||
#include <EASTL/optional.h>
|
#include <EASTL/optional.h>
|
||||||
|
#include <EASTL/span.h>
|
||||||
#include <EASTL/vector.h>
|
#include <EASTL/vector.h>
|
||||||
#include <ankerl/unordered_dense.h>
|
#include <ankerl/unordered_dense.h>
|
||||||
#include <benchmark/benchmark.h>
|
#include <benchmark/benchmark.h>
|
||||||
@@ -46,7 +47,7 @@ class SerializationManagerFixture: public benchmark::Fixture
|
|||||||
static constexpr std::uint32_t REFS_PER_ROOT = 4;
|
static constexpr std::uint32_t REFS_PER_ROOT = 4;
|
||||||
static constexpr std::size_t ASSET_PAYLOAD_SIZE = 256;
|
static constexpr std::size_t ASSET_PAYLOAD_SIZE = 256;
|
||||||
|
|
||||||
void SetUp(benchmark::State&) override
|
void SetUp([[maybe_unused]] benchmark::State& p_state) override
|
||||||
{
|
{
|
||||||
m_previousDataAccessor = g_dataAccessor;
|
m_previousDataAccessor = g_dataAccessor;
|
||||||
m_previousAssetLibrary = g_activeAssetLibrary;
|
m_previousAssetLibrary = g_activeAssetLibrary;
|
||||||
@@ -56,8 +57,8 @@ class SerializationManagerFixture: public benchmark::Fixture
|
|||||||
// iteration counts until it reaches a stable measurement), so rebuilding
|
// iteration counts until it reaches a stable measurement), so rebuilding
|
||||||
// the data store each time would dominate the total benchmark time.
|
// the data store each time would dominate the total benchmark time.
|
||||||
static const SharedData& s_data = BuildData();
|
static const SharedData& s_data = BuildData();
|
||||||
m_rootUuids = &s_data.rootUuids;
|
m_rootUuids = s_data.rootUuids;
|
||||||
m_leafUuids = &s_data.leafUuids;
|
m_leafUuids = s_data.leafUuids;
|
||||||
m_rootTotalBytes = &s_data.rootTotalBytes;
|
m_rootTotalBytes = &s_data.rootTotalBytes;
|
||||||
|
|
||||||
#if defined BIGFOOT_TOOLMODE
|
#if defined BIGFOOT_TOOLMODE
|
||||||
@@ -69,7 +70,7 @@ class SerializationManagerFixture: public benchmark::Fixture
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown(benchmark::State&) override
|
void TearDown([[maybe_unused]] benchmark::State& p_state) override
|
||||||
{
|
{
|
||||||
#if defined BIGFOOT_TOOLMODE
|
#if defined BIGFOOT_TOOLMODE
|
||||||
m_bigFile.reset();
|
m_bigFile.reset();
|
||||||
@@ -103,7 +104,7 @@ class SerializationManagerFixture: public benchmark::Fixture
|
|||||||
batch.reserve(p_batchSize);
|
batch.reserve(p_batchSize);
|
||||||
for (std::size_t i = 0; i < p_batchSize; ++i)
|
for (std::size_t i = 0; i < p_batchSize; ++i)
|
||||||
{
|
{
|
||||||
batch.push_back((*m_rootUuids)[Random::get<std::size_t>(0, m_rootUuids->size() - 1)]);
|
batch.push_back(m_rootUuids[Random::get<std::size_t>(0, m_rootUuids.size() - 1)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return batch;
|
return batch;
|
||||||
@@ -138,8 +139,8 @@ class SerializationManagerFixture: public benchmark::Fixture
|
|||||||
DataAccessor* m_previousDataAccessor = nullptr;
|
DataAccessor* m_previousDataAccessor = nullptr;
|
||||||
AssetLibrary* m_previousAssetLibrary = nullptr;
|
AssetLibrary* m_previousAssetLibrary = nullptr;
|
||||||
|
|
||||||
const eastl::vector<UUID>* m_rootUuids = nullptr;
|
eastl::span<const UUID> m_rootUuids;
|
||||||
const eastl::vector<UUID>* m_leafUuids = nullptr;
|
eastl::span<const UUID> m_leafUuids;
|
||||||
const ankerl::unordered_dense::map<UUID, std::size_t>* m_rootTotalBytes = nullptr;
|
const ankerl::unordered_dense::map<UUID, std::size_t>* m_rootTotalBytes = nullptr;
|
||||||
|
|
||||||
#if defined BIGFOOT_TOOLMODE
|
#if defined BIGFOOT_TOOLMODE
|
||||||
@@ -204,7 +205,7 @@ class SerializationManagerFixture: public benchmark::Fixture
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined BIGFOOT_TOOLMODE
|
#if defined BIGFOOT_TOOLMODE
|
||||||
BigFile bigFile {File {BIGFILE_ENGINEBENCHMARKS_LOCATION}};
|
BigFile bigFile {File { BIGFILE_ENGINEBENCHMARKS_LOCATION }};
|
||||||
bigFile.Clear();
|
bigFile.Clear();
|
||||||
bigFile.SaveAssetFlatbuffers(uuids, flatbuffers, hardReferences);
|
bigFile.SaveAssetFlatbuffers(uuids, flatbuffers, hardReferences);
|
||||||
#elif defined BIGFOOT_GAME
|
#elif defined BIGFOOT_GAME
|
||||||
@@ -250,7 +251,7 @@ BENCHMARK_DEFINE_F(SerializationManagerFixture, LoadAsset)(benchmark::State& sta
|
|||||||
AssetContainer<BenchmarkAsset> rootContainer;
|
AssetContainer<BenchmarkAsset> rootContainer;
|
||||||
ResetActiveLibrary(library, leafContainer, rootContainer);
|
ResetActiveLibrary(library, leafContainer, rootContainer);
|
||||||
|
|
||||||
const UUID uuid = (*m_rootUuids)[Random::get<std::size_t>(0, m_rootUuids->size() - 1)];
|
const UUID uuid = m_rootUuids[Random::get<std::size_t>(0, m_rootUuids.size() - 1)];
|
||||||
const std::size_t uuidBytes = m_rootTotalBytes->at(uuid);
|
const std::size_t uuidBytes = m_rootTotalBytes->at(uuid);
|
||||||
state.ResumeTiming();
|
state.ResumeTiming();
|
||||||
|
|
||||||
@@ -321,14 +322,14 @@ BENCHMARK_DEFINE_F(SerializationManagerFixture, SaveAsset)(benchmark::State& sta
|
|||||||
asset->GetAsset().payload.assign(ASSET_PAYLOAD_SIZE, std::uint8_t {0xAB});
|
asset->GetAsset().payload.assign(ASSET_PAYLOAD_SIZE, std::uint8_t {0xAB});
|
||||||
for (std::uint32_t j = 0; j < REFS_PER_ROOT; ++j)
|
for (std::uint32_t j = 0; j < REFS_PER_ROOT; ++j)
|
||||||
{
|
{
|
||||||
asset->GetAsset().refs.emplace_back((*m_leafUuids)[Random::get<std::size_t>(0, m_leafUuids->size() - 1)]);
|
asset->GetAsset().refs.emplace_back(m_leafUuids[Random::get<std::size_t>(0, m_leafUuids.size() - 1)]);
|
||||||
}
|
}
|
||||||
const UUID uuid = asset->GetHeader().uuid;
|
const UUID uuid = asset->GetHeader().uuid;
|
||||||
const std::size_t assetBytes = asset->Pack().size();
|
const std::size_t assetBytes = asset->Pack().size();
|
||||||
|
bytesProcessed += static_cast<std::int64_t>(assetBytes);
|
||||||
state.ResumeTiming();
|
state.ResumeTiming();
|
||||||
|
|
||||||
benchmark::DoNotOptimize(SerializationManager::SaveAsset(uuid));
|
benchmark::DoNotOptimize(SerializationManager::SaveAsset(uuid));
|
||||||
bytesProcessed += static_cast<std::int64_t>(assetBytes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
state.SetItemsProcessed(state.iterations());
|
state.SetItemsProcessed(state.iterations());
|
||||||
@@ -363,8 +364,7 @@ BENCHMARK_DEFINE_F(SerializationManagerFixture, SaveAssets)(benchmark::State& st
|
|||||||
asset->GetAsset().payload.assign(ASSET_PAYLOAD_SIZE, std::uint8_t {0xAB});
|
asset->GetAsset().payload.assign(ASSET_PAYLOAD_SIZE, std::uint8_t {0xAB});
|
||||||
for (std::uint32_t j = 0; j < REFS_PER_ROOT; ++j)
|
for (std::uint32_t j = 0; j < REFS_PER_ROOT; ++j)
|
||||||
{
|
{
|
||||||
asset->GetAsset().refs.emplace_back(
|
asset->GetAsset().refs.emplace_back(m_leafUuids[Random::get<std::size_t>(0, m_leafUuids.size() - 1)]);
|
||||||
(*m_leafUuids)[Random::get<std::size_t>(0, m_leafUuids->size() - 1)]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
batchBytes += asset->Pack().size();
|
batchBytes += asset->Pack().size();
|
||||||
|
|||||||
Reference in New Issue
Block a user