diff --git a/benchmarks.yml b/benchmarks.yml index 0035bf87..b0ef6651 100644 --- a/benchmarks.yml +++ b/benchmarks.yml @@ -136,6 +136,11 @@ sudoku: splay: desc: Splay tree operations (insert, find, remove) to stress GC. single_file: true +string_malloc_pressure: + desc: Allocates and retains many empty Strings with large reserved capacity to exercise GC under malloc-backed String buffer pressure. + category: gc + single_file: true + default_harness: harness-gc tinygql: desc: TinyGQL gem parsing a large file in pure Ruby diff --git a/benchmarks/string_malloc_pressure.rb b/benchmarks/string_malloc_pressure.rb new file mode 100644 index 00000000..ebda6860 --- /dev/null +++ b/benchmarks/string_malloc_pressure.rb @@ -0,0 +1,12 @@ +require_relative '../harness/loader' + +def build_string_malloc_pressure + live = [] + 500.times do + live << Array.new(200) { String.new(capacity: 64 * 1024) } + end +end + +run_benchmark(10) do + build_string_malloc_pressure +end