Compare commits

..

9 Commits

Author SHA1 Message Date
hashlag
b707e1ce68 Merge branch 'bench'
All checks were successful
Chaos CI / test-and-benchmark (push) Successful in 1m55s
2026-01-25 18:12:13 +03:00
hashlag
b9eb1a5fc8 Rename job build-and-test --> test-and-benchmark
All checks were successful
Chaos CI / test-and-benchmark (push) Successful in 1m55s
2026-01-25 18:11:26 +03:00
hashlag
28334d1d78 Run tests and benchmarks in one job
All checks were successful
Chaos CI / build-and-test (push) Successful in 1m55s
2026-01-25 18:07:41 +03:00
hashlag
d30d5f8a74 Build benchmarks with CMAKE_BUILD_TYPE=Release
All checks were successful
Chaos CI / build-and-test (push) Successful in 57s
Chaos CI / build-and-benchmark (push) Successful in 1m14s
2026-01-25 17:48:57 +03:00
hashlag
478012dd10 Place test and bench jobs in one .yaml
All checks were successful
Chaos CI / build-and-test (push) Successful in 55s
Chaos CI / build-and-benchmark (push) Successful in 1m0s
2026-01-25 17:42:24 +03:00
hashlag
ff57cd0d31 Fix #includes: Add <cstring> for strlen()
All checks were successful
ChaosBenchmark CI / build-and-benchmark (push) Successful in 57s
ChaosTest CI / build-and-test (push) Successful in 54s
2026-01-25 17:35:53 +03:00
hashlag
3e7a0f3e53 Fix benchmark job name 2026-01-25 17:34:12 +03:00
hashlag
c0685d00b5 Add ChaosBenchmarkCI.yaml workflow
Some checks failed
ChaosBenchmark CI / build-and-test (push) Failing after 57s
ChaosTest CI / build-and-test (push) Failing after 54s
2026-01-25 17:30:50 +03:00
hashlag
660b13a045 ChaosBenches: Add Md4HasherCreateComputeDeleteBench 2026-01-25 17:24:58 +03:00
4 changed files with 68 additions and 3 deletions

View File

@@ -1,9 +1,9 @@
name: ChaosTest CI
name: Chaos CI
on: [push, pull_request]
jobs:
build-and-test:
test-and-benchmark:
runs-on: ubuntu-latest
steps:
@@ -24,7 +24,19 @@ jobs:
cmake ..
cmake --build .
- name: Configure, build [Release]
run: |
mkdir build-release
cd build-release
cmake .. -D CMAKE_BUILD_TYPE=Release
cmake --build .
- name: Run tests
run: |
cd build
./ChaosTests/ChaosTests
- name: Run benchmarks
run: |
cd build-release
./ChaosBenches/ChaosBenches

View File

@@ -15,3 +15,4 @@ target_include_directories(Chaos INTERFACE
)
add_subdirectory(ChaosTests)
add_subdirectory(ChaosBenches)

View File

@@ -0,0 +1,21 @@
include(FetchContent)
cmake_policy(SET CMP0135 NEW)
FetchContent_Declare(
googlebenchmark
URL https://github.com/google/benchmark/archive/refs/tags/v1.9.5.tar.gz
URL_HASH SHA256=9631341c82bac4a288bef951f8b26b41f69021794184ece969f8473977eaa340
)
set(BENCHMARK_ENABLE_WERROR OFF CACHE BOOL "" FORCE)
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googlebenchmark)
set(ChaosBenches_SOURCE Hash/Md4HasherBenches.cpp)
add_executable(ChaosBenches ${ChaosBenches_SOURCE})
target_link_libraries(ChaosBenches benchmark::benchmark)
target_include_directories(ChaosBenches PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/Chaos>
)

View File

@@ -0,0 +1,31 @@
#include <benchmark/benchmark.h>
#include <cstring>
#include <Hash/Md4.hpp>
using namespace Chaos::Hash::Md4;
static void Md4HasherCreateComputeDeleteBench(benchmark::State & state)
{
const char * data
= "All states, all powers, that have held and hold rule over men have been and are either republics or principalities.\n"
"Principalities are either hereditary, in which the family has been long established; or they are new.\n"
"The new are either entirely new, as was Milan to Francesco Sforza, or they are, as it were, members annexed to the hereditary state of the "
"prince who has acquired them, as was the kingdom of Naples to that of the King of Spain.\n"
"Such dominions thus acquired are either accustomed to live under a prince, or to live in freedom; and are acquired either by the arms of the "
"prince himself, or of others, or else by fortune or by ability.";
const size_t dataLen = strlen(data);
for (auto _ : state)
{
Md4Hasher hasher;
hasher.Update(data, data + dataLen);
Md4Hash result = hasher.Finish();
benchmark::DoNotOptimize(result);
}
}
BENCHMARK(Md4HasherCreateComputeDeleteBench);
BENCHMARK_MAIN();