From 5e773aaf56996108ade9f072e7c396f4ed4be810 Mon Sep 17 00:00:00 2001 From: Feoramund <161657516+Feoramund@users.noreply.github.com> Date: Tue, 8 Apr 2025 15:48:40 -0400 Subject: [PATCH] Adjust heap allocator benchmarks --- tests/heap_allocator/test_bench.odin | 94 ++++++++++++++-------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/tests/heap_allocator/test_bench.odin b/tests/heap_allocator/test_bench.odin index 649c61b56..fad08c38b 100644 --- a/tests/heap_allocator/test_bench.odin +++ b/tests/heap_allocator/test_bench.odin @@ -1378,39 +1378,39 @@ main :: proc() { log.info("--- Single-threaded benchmarks ---") log.info("* Freeing forwards ...") - bench_alloc_n_then_free_n(1_000_000, int) - bench_alloc_n_then_free_n(1_000_000, Struct_16) - bench_alloc_n_then_free_n(1_000_000, Struct_32) - bench_alloc_n_then_free_n(1_000_000, Struct_64) - bench_alloc_n_then_free_n(1_000_000, Struct_512) - bench_alloc_n_then_free_n(10_000, [8192]u8) - bench_alloc_n_then_free_n(1000, [runtime.HEAP_SLAB_SIZE/4]u8) - bench_alloc_n_then_free_n(1000, [runtime.HEAP_SLAB_SIZE*4]u8) - bench_alloc_n_then_free_n(10, [runtime.SUPERPAGE_SIZE]u8) + bench_alloc_n_then_free_n(10_000_000, int) + bench_alloc_n_then_free_n(10_000_000, Struct_16) + bench_alloc_n_then_free_n(10_000_000, Struct_32) + bench_alloc_n_then_free_n(10_000_000, Struct_64) + bench_alloc_n_then_free_n(10_000_000, Struct_512) + bench_alloc_n_then_free_n(100_000, [8192]u8) + bench_alloc_n_then_free_n(10_000, [runtime.HEAP_SLAB_SIZE/4]u8) + bench_alloc_n_then_free_n(10_000, [runtime.HEAP_SLAB_SIZE*4]u8) + bench_alloc_n_then_free_n(100, [runtime.SUPERPAGE_SIZE]u8) log.info("* Freeing backwards ...") - bench_alloc_n_then_free_n_backwards(1_000_000, int) - bench_alloc_n_then_free_n_backwards(1_000_000, Struct_16) - bench_alloc_n_then_free_n_backwards(1_000_000, Struct_32) - bench_alloc_n_then_free_n_backwards(1_000_000, Struct_64) - bench_alloc_n_then_free_n_backwards(1_000_000, Struct_512) - bench_alloc_n_then_free_n_backwards(10_000, [8192]u8) - bench_alloc_n_then_free_n_backwards(1000, [runtime.HEAP_SLAB_SIZE/4]u8) - bench_alloc_n_then_free_n_backwards(1000, [runtime.HEAP_SLAB_SIZE*4]u8) - bench_alloc_n_then_free_n_backwards(10, [runtime.SUPERPAGE_SIZE]u8) + bench_alloc_n_then_free_n_backwards(10_000_000, int) + bench_alloc_n_then_free_n_backwards(10_000_000, Struct_16) + bench_alloc_n_then_free_n_backwards(10_000_000, Struct_32) + bench_alloc_n_then_free_n_backwards(10_000_000, Struct_64) + bench_alloc_n_then_free_n_backwards(10_000_000, Struct_512) + bench_alloc_n_then_free_n_backwards(100_000, [8192]u8) + bench_alloc_n_then_free_n_backwards(10_000, [runtime.HEAP_SLAB_SIZE/4]u8) + bench_alloc_n_then_free_n_backwards(10_000, [runtime.HEAP_SLAB_SIZE*4]u8) + bench_alloc_n_then_free_n_backwards(100, [runtime.SUPERPAGE_SIZE]u8) log.info("* Freeing randomly ...") - bench_alloc_n_then_free_n_randomly(1_000_000, int) - bench_alloc_n_then_free_n_randomly(1_000_000, Struct_16) - bench_alloc_n_then_free_n_randomly(1_000_000, Struct_32) - bench_alloc_n_then_free_n_randomly(1_000_000, Struct_64) - bench_alloc_n_then_free_n_randomly(1_000_000, Struct_512) - bench_alloc_n_then_free_n_randomly(10_000, [8192]u8) - bench_alloc_n_then_free_n_randomly(10_000, [runtime.HEAP_SLAB_SIZE/4]u8) - bench_alloc_n_then_free_n_randomly(10_000, [runtime.HEAP_SLAB_SIZE-runtime.HEAP_SLAB_ALLOCATION_BOOK_KEEPING]u8) - bench_alloc_n_then_free_n_randomly(10_000, [runtime.HEAP_SLAB_SIZE]u8) - bench_alloc_n_then_free_n_randomly(10_000, [runtime.HEAP_SLAB_SIZE*2]u8) - bench_alloc_n_then_free_n_randomly(10, [runtime.SUPERPAGE_SIZE]u8) + bench_alloc_n_then_free_n_randomly(10_000_000, int) + bench_alloc_n_then_free_n_randomly(10_000_000, Struct_16) + bench_alloc_n_then_free_n_randomly(10_000_000, Struct_32) + bench_alloc_n_then_free_n_randomly(10_000_000, Struct_64) + bench_alloc_n_then_free_n_randomly(10_000_000, Struct_512) + bench_alloc_n_then_free_n_randomly(100_000, [8192]u8) + bench_alloc_n_then_free_n_randomly(100_000, [runtime.HEAP_SLAB_SIZE/4]u8) + bench_alloc_n_then_free_n_randomly(100_000, [runtime.HEAP_SLAB_SIZE-runtime.HEAP_SLAB_ALLOCATION_BOOK_KEEPING]u8) + bench_alloc_n_then_free_n_randomly(100_000, [runtime.HEAP_SLAB_SIZE]u8) + bench_alloc_n_then_free_n_randomly(100_000, [runtime.HEAP_SLAB_SIZE*2]u8) + bench_alloc_n_then_free_n_randomly(100, [runtime.SUPERPAGE_SIZE]u8) log.info("* Allocating and freeing repeatedly ...") bench_alloc_1_then_free_1_repeatedly(100_000, int) @@ -1424,34 +1424,34 @@ main :: proc() { if opt.parallel_benchmarks { log.info("--- Multi-threaded benchmarks ---") - bench_1_producer_n_consumer_for_m_alloc(1, 10_000, Struct_16) - bench_1_producer_n_consumer_for_m_alloc(2, 10_000, Struct_16) - bench_1_producer_n_consumer_for_m_alloc(4, 10_000, Struct_16) + bench_1_producer_n_consumer_for_m_alloc(1, 100_000, Struct_16) + bench_1_producer_n_consumer_for_m_alloc(2, 100_000, Struct_16) + bench_1_producer_n_consumer_for_m_alloc(4, 100_000, Struct_16) - bench_1_producer_n_consumer_for_m_alloc(1, 10_000, Struct_32) - bench_1_producer_n_consumer_for_m_alloc(2, 10_000, Struct_32) - bench_1_producer_n_consumer_for_m_alloc(4, 10_000, Struct_32) + bench_1_producer_n_consumer_for_m_alloc(1, 100_000, Struct_32) + bench_1_producer_n_consumer_for_m_alloc(2, 100_000, Struct_32) + bench_1_producer_n_consumer_for_m_alloc(4, 100_000, Struct_32) - bench_1_producer_n_consumer_for_m_alloc(1, 10_000, Struct_64) - bench_1_producer_n_consumer_for_m_alloc(2, 10_000, Struct_64) - bench_1_producer_n_consumer_for_m_alloc(4, 10_000, Struct_64) + bench_1_producer_n_consumer_for_m_alloc(1, 100_000, Struct_64) + bench_1_producer_n_consumer_for_m_alloc(2, 100_000, Struct_64) + bench_1_producer_n_consumer_for_m_alloc(4, 100_000, Struct_64) - bench_1_producer_n_consumer_for_m_alloc(1, 10_000, Struct_512) - bench_1_producer_n_consumer_for_m_alloc(2, 10_000, Struct_512) - bench_1_producer_n_consumer_for_m_alloc(4, 10_000, Struct_512) + bench_1_producer_n_consumer_for_m_alloc(1, 100_000, Struct_512) + bench_1_producer_n_consumer_for_m_alloc(2, 100_000, Struct_512) + bench_1_producer_n_consumer_for_m_alloc(4, 100_000, Struct_512) - bench_1_producer_n_consumer_for_m_alloc(1, 1_000, [8192]u8) - bench_1_producer_n_consumer_for_m_alloc(2, 1_000, [8192]u8) - bench_1_producer_n_consumer_for_m_alloc(4, 1_000, [8192]u8) + bench_1_producer_n_consumer_for_m_alloc(1, 10_000, [8192]u8) + bench_1_producer_n_consumer_for_m_alloc(2, 10_000, [8192]u8) + bench_1_producer_n_consumer_for_m_alloc(4, 10_000, [8192]u8) - bench_1_producer_n_consumer_for_m_alloc(4, 10, [runtime.HEAP_SLAB_SIZE]u8) + bench_1_producer_n_consumer_for_m_alloc(4, 100, [runtime.HEAP_SLAB_SIZE]u8) when .Thread not_in ODIN_SANITIZER_FLAGS { // NOTE: TSan doesn't work well with excessive thread counts, // in my experience. + bench_1_producer_n_consumer_for_m_alloc(16, 1_000, Struct_32) + bench_1_producer_n_consumer_for_m_alloc(24, 1_000, Struct_32) bench_1_producer_n_consumer_for_m_alloc(32, 1_000, Struct_32) - bench_1_producer_n_consumer_for_m_alloc(64, 1_000, Struct_32) - bench_1_producer_n_consumer_for_m_alloc(128, 1_000, Struct_32) } }