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
commitb04ded61081cb729fb0979d98148025815e998da (patch)
tree233fdd9a7402fb9a71731751bbbca7f01027fb68
parent7037ccbafe1b1a5540a50440e203d4298b8b2777 (diff)
downloadtxr-b04ded61081cb729fb0979d98148025815e998da.tar.gz
txr-b04ded61081cb729fb0979d98148025815e998da.tar.bz2
txr-b04ded61081cb729fb0979d98148025815e998da.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);