From 81a891544d185d98652c966bd874e6d1f089c858 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 29 Jan 2025 20:36:14 -0800 Subject: string-extend: grow faster. * lib.c (string_extend): When more space is needed in the string, grow by 50% rather than 25%. This speeds up code at the expense of some wasted space. Waste space can be dealt with by the final flag in programs where it matters. --- lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib.c b/lib.c index 4f5cb11d..99674be5 100644 --- a/lib.c +++ b/lib.c @@ -5416,10 +5416,10 @@ val string_extend(val str, val tail, val finish_in) if (needed > alloc || finish) { if (finish) alloc = needed; - else if (alloc >= (NUM_MAX - NUM_MAX / 5)) + else if (alloc >= (NUM_MAX - NUM_MAX / 3)) alloc = NUM_MAX; else - alloc = max(alloc + alloc / 4, needed); + alloc = max(alloc + alloc / 2, needed); if (alloc != oalloc) { str->st.str = chk_wrealloc(str->st.str, alloc); -- cgit v1.2.3