summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Valentine-House <matt@eightbitraptor.com>2023-01-13 14:30:47 +0000
committerPeter Zhu <peter@peterzhu.ca>2023-01-13 10:31:35 -0500
commit8a93e5d01bf8bc185426a62ebb675460592a609b (patch)
treedcb2db0c4fb0e65baca445fc3390d61c563d45da
parent2605615fe6c540740ce921c181c1bc081c019e49 (diff)
downloadruby-8a93e5d01bf8bc185426a62ebb675460592a609b.tar.gz
Use str_enc_copy_direct to improve performance
str_enc_copy_direct copies the string encoding over without checking the frozen status of the string. Because we know that we're safe here (we only use this function when interpolating strings on the stack via a concatstrings instruction) we can safely skip this check
-rw-r--r--string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index 70dc9c485f..de96796269 100644
--- a/string.c
+++ b/string.c
@@ -3352,7 +3352,7 @@ rb_str_concat_literals(size_t num, const VALUE *strary)
for (i = 0; i < num; ++i) { len += RSTRING_LEN(strary[i]); }
str = rb_str_buf_new(len);
- str_enc_copy(str, strary[0]);
+ str_enc_copy_direct(str, strary[0]);
for (i = s; i < num; ++i) {
const VALUE v = strary[i];