summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-01-30 20:14:19 -0800
committerKaz Kylheku <kaz@kylheku.com>2025-01-30 20:14:19 -0800
commit0a49460df0a375b7087ee8aab1d55b7be043d4de (patch)
tree233fdd9a7402fb9a71731751bbbca7f01027fb68
parentcb7e89dc7946ed1ee27f5e7795d597981ef29ddd (diff)
downloadtxr-0a49460df0a375b7087ee8aab1d55b7be043d4de.tar.gz
txr-0a49460df0a375b7087ee8aab1d55b7be043d4de.tar.bz2
txr-0a49460df0a375b7087ee8aab1d55b7be043d4de.zip
string-extend: don't use set macro to update length.
* lib.c (string_extend): We know that num_fast + delta is in the fixnum range, because we checked this condition. So we can just assign it without informing the garbage collector. This yields about a 16% speedup in get-csv.
-rw-r--r--lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index e23c2ad3..d0667a57 100644
--- a/lib.c
+++ b/lib.c
@@ -5423,7 +5423,7 @@ val string_extend(val str, val tail, val finish_in)
}
}
- set(mkloc(str->st.len, str), num(len + delta));
+ str->st.len = num_fast(len + delta);
if (stringp(tail)) {
wmemcpy(str->st.str + len, c_str(tail, self), delta + 1);