Skip to content

Commit

Permalink
feat: BuildBuddy (#2)
Browse files Browse the repository at this point in the history
- Add BuildBuddy CI
- hotfix of Perf Tests which wasn't properly fix to the latest ProjectCore
  • Loading branch information
0-Sacha authored May 2, 2024
1 parent 836f967 commit f67fbae
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 11 deletions.
13 changes: 13 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,16 @@ common:microsoft_compiler_opts --copt /std:c++20
# BuildBuddy
common:linux --workspace_status_command=$(pwd)/.buildbuddy/workspace_status.sh
common:windows --workspace_status_command=.buildbuddy/workspace_status.bat

common:buildbuddy --build_metadata=ROLE=CI
common:buildbuddy --bes_results_url=https://sacha.buildbuddy.io/invocation/
common:buildbuddy --bes_backend=grpcs://sacha.buildbuddy.io
common:buildbuddy --remote_cache=grpcs://sacha.buildbuddy.io
common:buildbuddy --remote_executor=grpcs://sacha.buildbuddy.io
common:buildbuddy --experimental_remote_cache_compression
common:buildbuddy --jobs=50
common:buildbuddy --nolegacy_important_outputs
common:buildbuddy --platforms=@buildbuddy_test//:buildbuddy_linux_x86_64
common:buildbuddy --extra_execution_platforms=@buildbuddy_test//:buildbuddy_linux_x86_64
common:buildbuddy --remote_instance_name=littleecs
common:buildbuddy --extra_toolchains=@buildbuddy_test//:toolchain_buildbuddy_gcc_12
20 changes: 10 additions & 10 deletions Tests/Perf/PerformanceTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "LittleECS/LittleECS.h"

#include "ProjectCore/Instrumentation/ProfilerManger/ProfilerManger.h"
#include "ProjectCore/ProfilerManager.h"

#include <set>

Expand Down Expand Up @@ -35,15 +35,15 @@ struct LECS::Detail::ComponentStorageInfo<BasicIntComponent> : public DefaultCom

#define BenchmarkTest(Size, Name) PCT_TEST_FUNC(PERFORMANCE, ADD_MANY_COMPONENT_ ## Name) \
{ \
ProjectCore::Instrumentation::Profiler profiler("ADD_MANY_COMPONENT_" #Name); \
ProjectCore::ProfilerManager::Profiler profiler("ADD_MANY_COMPONENT_" #Name); \
\
LECS::Registry registry; \
\
std::vector<LECS::EntityId> entities; \
entities.reserve(Size); \
\
{ \
ProjectCore::Instrumentation::ScopeProfile scope(profiler, "Create Entities"); \
ProjectCore::ProfilerManager::ScopeProfile scope(profiler, "Create Entities"); \
\
for (std::size_t i = 0; i < Size; ++i) \
{ \
Expand All @@ -52,7 +52,7 @@ struct LECS::Detail::ComponentStorageInfo<BasicIntComponent> : public DefaultCom
} \
\
{ \
ProjectCore::Instrumentation::ScopeProfile scope(profiler, "Check Entities Ids"); \
ProjectCore::ProfilerManager::ScopeProfile scope(profiler, "Check Entities Ids"); \
\
bool uid = true; \
\
Expand Down Expand Up @@ -91,7 +91,7 @@ struct LECS::Detail::ComponentStorageInfo<BasicIntComponent> : public DefaultCom
} \
\
{ \
ProjectCore::Instrumentation::ScopeProfile scope(profiler, "Add Component"); \
ProjectCore::ProfilerManager::ScopeProfile scope(profiler, "Add Component"); \
\
for (std::size_t i = 0; i < Size; ++i) \
{ \
Expand All @@ -100,7 +100,7 @@ struct LECS::Detail::ComponentStorageInfo<BasicIntComponent> : public DefaultCom
} \
\
{ \
ProjectCore::Instrumentation::ScopeProfile scope(profiler, "Get Component"); \
ProjectCore::ProfilerManager::ScopeProfile scope(profiler, "Get Component"); \
\
for (std::size_t i = 0; i < Size; ++i) \
{ \
Expand All @@ -109,7 +109,7 @@ struct LECS::Detail::ComponentStorageInfo<BasicIntComponent> : public DefaultCom
} \
\
{ \
ProjectCore::Instrumentation::ScopeProfile scope(profiler, "Has Component"); \
ProjectCore::ProfilerManager::ScopeProfile scope(profiler, "Has Component"); \
\
for (std::size_t i = 0; i < Size; ++i) \
{ \
Expand All @@ -119,20 +119,20 @@ struct LECS::Detail::ComponentStorageInfo<BasicIntComponent> : public DefaultCom
} \
\
{ \
ProjectCore::Instrumentation::ScopeProfile scope(profiler, "ForEach Component"); \
ProjectCore::ProfilerManager::ScopeProfile scope(profiler, "ForEach Component"); \
\
registry.ForEachUniqueComponent<BasicIntComponent>([](LECS::EntityId, BasicIntComponent& k) \
{ \
k = 5ull; \
}); \
} \
\
ProjectCore::Instrumentation::ProfilerFactory::ToJson(profiler); \
ProjectCore::ProfilerManager::ProfilerFactory::ToJson(profiler); \
}

BenchmarkTest(1'000, 1K);
BenchmarkTest(10'000, 10K);
BenchmarkTest(100'000, 100K);
BenchmarkTest(1'000'000, 1M);
BenchmarkTest(10'000'000, 10M);
BenchmarkTest(100'000'000, 100M);
// BenchmarkTest(100'000'000, 100M);
24 changes: 24 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
""

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "bazel_utilities",
strip_prefix = "bazel_utilities-d748d078d0bdd4e5fe9020e8011a46edb484525e",
urls = [ "https://github.com/0-Sacha/bazel_utilities/archive/d748d078d0bdd4e5fe9020e8011a46edb484525e.zip" ],
integrity = "sha256-qakyhHoLPrGK/3zD+dWIL7wGSjLwMX69TiSGA05Wu2c=",
)

http_archive(
name = "bazel_buildbuddy",
strip_prefix = "bazel_buildbuddy-89937f1942a9271348c0963ef89fb67c240c3afd",
urls = [ "https://github.com/0-Sacha/bazel_buildbuddy/archive/89937f1942a9271348c0963ef89fb67c240c3afd.zip" ],
integrity = "sha256-M8sEkfNBjSivQhIRYRzCXIq7ix3w23UckP0z9T/L3II=",
)

load("@bazel_buildbuddy//:rules.bzl", "buildbuddy_toolchain")

buildbuddy_toolchain(
name = "buildbuddy_test",
auto_register_toolchain = False
)
2 changes: 1 addition & 1 deletion buildbuddy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ actions:
branches:
- "*"
bazel_commands:
- "test --remote_header=x-buildbuddy-api-key=$BUILDBUDDY_RBEKEY_WINDOWS_WSL //..."
- "test -s --config=buildbuddy --remote_header=x-buildbuddy-api-key=${BUILDBUDDY_WINDOWS_WSL} //:LittleECSTests"

0 comments on commit f67fbae

Please sign in to comment.