From 8c94fbe94502eecf2f2c2b960642c6e09c9106a3 Mon Sep 17 00:00:00 2001 From: Oxore Date: Sat, 3 Aug 2024 15:21:59 +0300 Subject: Reduce initial buffer size --- Readme.md | 14 +++++++------- arena-malloc.c | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Readme.md b/Readme.md index 67d3dc5..60001bc 100644 --- a/Readme.md +++ b/Readme.md @@ -9,16 +9,16 @@ $ perf stat -r10 -B ./arena-malloc Performance counter stats for './arena-malloc' (10 runs): - 340.31 msec task-clock:u # 0.965 CPUs utilized ( +- 0.77% ) + 488.01 msec task-clock:u # 0.976 CPUs utilized ( +- 1.63% ) 0 context-switches:u # 0.000 /sec 0 cpu-migrations:u # 0.000 /sec - 6,055 page-faults:u # 17.792 K/sec ( +- 0.01% ) - 255,422,997 cycles:u # 0.751 GHz ( +- 0.07% ) - 700,131,646 instructions:u # 2.74 insn per cycle ( +- 0.00% ) - 100,031,363 branches:u # 293.938 M/sec ( +- 0.00% ) - 2,612 branch-misses:u # 0.00% of all branches ( +- 0.97% ) + 44,696 page-faults:u # 91.589 K/sec ( +- 4.72% ) + 278,282,629 cycles:u # 0.570 GHz ( +- 0.45% ) + 700,173,708 instructions:u # 2.52 insn per cycle ( +- 0.00% ) + 100,070,698 branches:u # 205.060 M/sec ( +- 0.00% ) + 2,739 branch-misses:u # 0.00% of all branches ( +- 0.89% ) - 0.35257 +- 0.00692 seconds time elapsed ( +- 1.96% ) + 0.49999 +- 0.00898 seconds time elapsed ( +- 1.80% ) ``` arena-memstream (`open_memstream`, `fwrite`, `fflush`): diff --git a/arena-malloc.c b/arena-malloc.c index 4246047..be97fb8 100644 --- a/arena-malloc.c +++ b/arena-malloc.c @@ -13,7 +13,7 @@ struct arena { void arena_create(struct arena *arena) { - unsigned long const init_size = 10ul * 1024ul * 1024ul; + unsigned long const init_size = 4ul * 1024ul; *arena = (struct arena){ .buffer = malloc(init_size), .size = init_size, -- cgit v1.2.3