diff options
author | Matt Valentine-House <matt@eightbitraptor.com> | 2023-01-10 17:58:45 +0000 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2023-01-13 10:31:35 -0500 |
commit | bb5fddd0709e17360eef343b986cd5a61ea2598c (patch) | |
tree | 01fa8706d87c5563b4c82a649248794752065bdd /string.c | |
parent | fc7f8520337be9513d984f67c9ef98ef85d03d0f (diff) | |
download | ruby-bb5fddd0709e17360eef343b986cd5a61ea2598c.tar.gz |
Remove MIN_PRE_ALLOC_SIZE from Strings.
This optimisation is no longer helpful now that we use VWA to allocate
strings in larger size pools where they can be embedded.
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 17 |
1 files changed, 4 insertions, 13 deletions
@@ -3340,28 +3340,19 @@ rb_str_append(VALUE str, VALUE str2) return rb_str_buf_append(str, str2); } -#define MIN_PRE_ALLOC_SIZE 48 - MJIT_FUNC_EXPORTED VALUE rb_str_concat_literals(size_t num, const VALUE *strary) { VALUE str; - size_t i, s; - long len = 1; + size_t i, s = 0; + unsigned long len = 1; if (UNLIKELY(!num)) return rb_str_new(0, 0); if (UNLIKELY(num == 1)) return rb_str_resurrect(strary[0]); for (i = 0; i < num; ++i) { len += RSTRING_LEN(strary[i]); } - if (LIKELY(len < MIN_PRE_ALLOC_SIZE)) { - str = rb_str_resurrect(strary[0]); - s = 1; - } - else { - str = rb_str_buf_new(len); - rb_enc_copy(str, strary[0]); - s = 0; - } + str = rb_str_buf_new(len); + str_enc_copy(str, strary[0]); for (i = s; i < num; ++i) { const VALUE v = strary[i]; |