commit 2d59b72f91ec5fb72a69fc0b09ad5fba24807239
parent 191fb44e1be803e1161752d75660aefc57a5d124
Author: Walther Chen <walther.chen@gmail.com>
Date:   Fri,  1 Nov 2024 11:17:37 -0400

lower page size for arenas in neighbor

Memory usage does go down when lowering page size in neighbor arenas
(although making it too small is not good either)

First is from before arena swapping. Second is arena swapping and page
size at 1024.

bioinformatics on  main [+1] > poop "./ba1j input.txt" "./ba1j-mem input.txt"
Benchmark 1 (99 runs): ./ba1j input.txt
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          50.5ms ± 2.81ms    45.8ms … 59.7ms          1 ( 1%)        0%
  peak_rss           22.4MB ± 52.8KB    22.3MB … 22.5MB          0 ( 0%)        0%
  cpu_cycles          110M  ± 2.82M      105M  …  120M           4 ( 4%)        0%
  instructions        223M  ± 3.92       223M  …  223M           1 ( 1%)        0%
  cache_references   1.53M  ± 15.0K     1.49M  … 1.60M           6 ( 6%)        0%
  cache_misses        660K  ± 48.6K      580K  …  764K           0 ( 0%)        0%
  branch_misses       140K  ± 2.12K      135K  …  145K           2 ( 2%)        0%
Benchmark 2 (147 runs): ./ba1j-mem input.txt
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          34.0ms ± 2.64ms    30.5ms … 46.0ms          3 ( 2%)        ⚡- 32.7% ±  1.4%
  peak_rss           19.1MB ± 52.8KB    19.1MB … 19.2MB          0 ( 0%)        ⚡- 14.6% ±  0.1%
  cpu_cycles         68.7M  ± 3.86M     65.5M  …  100M           7 ( 5%)        ⚡- 37.5% ±  0.8%
  instructions        128M  ± 2.34       128M  …  128M           4 ( 3%)        ⚡- 42.3% ±  0.0%
  cache_references   1.07M  ± 13.9K     1.04M  … 1.17M           8 ( 5%)        ⚡- 30.5% ±  0.2%
  cache_misses        359K  ± 51.1K      297K  …  598K           4 ( 3%)        ⚡- 45.7% ±  1.9%
  branch_misses       133K  ± 2.06K      130K  …  140K           4 ( 3%)        ⚡-  4.8% ±  0.4%

Diffstat:
Mutil.c3 | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/util.c3 b/util.c3 @@ -209,8 +209,8 @@ fn String[] neighbors(String pattern, int d, Allocator alloc = allocator::heap() if (pattern.len == 0) return {}; DynamicArenaAllocator neighborhood_arena; DynamicArenaAllocator suffix_neighborhood_arena; - neighborhood_arena.init(4096, allocator::temp()); - suffix_neighborhood_arena.init(4096, allocator::temp()); + neighborhood_arena.init(1024, allocator::temp()); + suffix_neighborhood_arena.init(1024, allocator::temp()); List(<String>) neighborhood; List(<String>) suffix_neighborhood; neighborhood.new_init_with_array({"A", "C", "G", "T"}, &neighborhood_arena);