Adjust heap allocator benchmarks

This commit is contained in:
Feoramund
2025-04-08 15:48:40 -04:00
parent acd5d0d40b
commit 5e773aaf56

View File

@@ -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)
}
}