зеркало из https://github.com/github/ruby.git
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
This commit is contained in:
Родитель
2605615fe6
Коммит
8a93e5d01b
2
string.c
2
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]); }
|
for (i = 0; i < num; ++i) { len += RSTRING_LEN(strary[i]); }
|
||||||
str = rb_str_buf_new(len);
|
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) {
|
for (i = s; i < num; ++i) {
|
||||||
const VALUE v = strary[i];
|
const VALUE v = strary[i];
|
||||||
|
|
Загрузка…
Ссылка в новой задаче