diff options
| author | Hans Kristian Rosbach <hk-git@circlestorm.org> | 2026-01-14 21:20:47 +0100 |
|---|---|---|
| committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2026-01-20 22:59:40 +0100 |
| commit | 3bae47cffbf4030843d6e061f1cc094eeab0e53f (patch) | |
| tree | 164701b21955350925a6afd76f11e69678b5d606 /test | |
| parent | 6963588b3eae983b549a23dfda9b415869663250 (diff) | |
| download | Project-Tick-3bae47cffbf4030843d6e061f1cc094eeab0e53f.tar.gz Project-Tick-3bae47cffbf4030843d6e061f1cc094eeab0e53f.zip | |
Use aligned alloc for insert_string benchmark
Diffstat (limited to 'test')
| -rw-r--r-- | test/benchmarks/benchmark_insert_string.cc | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/test/benchmarks/benchmark_insert_string.cc b/test/benchmarks/benchmark_insert_string.cc index 4bff1fda20..fafba3c4cd 100644 --- a/test/benchmarks/benchmark_insert_string.cc +++ b/test/benchmarks/benchmark_insert_string.cc @@ -10,7 +10,6 @@ extern "C" { # include "zbuild.h" -# include "zutil_p.h" # include "deflate.h" # include "arch_functions.h" # include "../test_cpu_features.h" @@ -29,7 +28,7 @@ protected: public: void SetUp(const ::benchmark::State&) { - s = (deflate_state*)zng_alloc(sizeof(deflate_state)); + s = (deflate_state*)zng_alloc_aligned(sizeof(deflate_state), 64); memset(s, 0, sizeof(deflate_state)); // Set up window parameters @@ -37,11 +36,11 @@ public: s->window_size = TEST_WINDOW_SIZE; // Allocate window - s->window = (uint8_t*)zng_alloc(TEST_WINDOW_SIZE); + s->window = (uint8_t*)zng_alloc_aligned(TEST_WINDOW_SIZE, 64); // Allocate hash tables - s->head = (Pos*)zng_alloc(HASH_SIZE * sizeof(Pos)); - s->prev = (Pos*)zng_alloc(MAX_WSIZE * sizeof(Pos)); + s->head = (Pos*)zng_alloc_aligned(HASH_SIZE * sizeof(Pos), 64); + s->prev = (Pos*)zng_alloc_aligned(MAX_WSIZE * sizeof(Pos), 64); // Initialize hash tables memset(s->head, 0, HASH_SIZE * sizeof(Pos)); @@ -58,10 +57,10 @@ public: } void TearDown(const ::benchmark::State&) { - zng_free(s->window); - zng_free(s->head); - zng_free(s->prev); - zng_free(s); + zng_free_aligned(s->window); + zng_free_aligned(s->head); + zng_free_aligned(s->prev); + zng_free_aligned(s); } }; |
