зеркало из https://github.com/github/ruby.git
rb_str_concat_literals: use rb_str_buf_append
That's about 1.30x faster.
This commit is contained in:
Родитель
e0cd466ae7
Коммит
cd1724bdde
|
@ -33,3 +33,13 @@ benchmark:
|
|||
buffer << UCHUNK << UCHUNK << UCHUNK << UCHUNK << UCHUNK << UCHUNK << UCHUNK << UCHUNK
|
||||
buffer << UCHUNK << UCHUNK << UCHUNK << UCHUNK << UCHUNK << UCHUNK << UCHUNK << UCHUNK
|
||||
buffer << UCHUNK << UCHUNK << UCHUNK << UCHUNK << UCHUNK << UCHUNK << UCHUNK
|
||||
interpolation: |
|
||||
buffer = "#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}" \
|
||||
"#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}" \
|
||||
"#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}" \
|
||||
"#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}" \
|
||||
"#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}" \
|
||||
"#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}" \
|
||||
"#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}" \
|
||||
"#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}" \
|
||||
"#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}"
|
||||
|
|
3
string.c
3
string.c
|
@ -3393,8 +3393,7 @@ rb_str_concat_literals(size_t num, const VALUE *strary)
|
|||
const VALUE v = strary[i];
|
||||
int encidx = ENCODING_GET(v);
|
||||
|
||||
rb_enc_cr_str_buf_cat(str, RSTRING_PTR(v), RSTRING_LEN(v),
|
||||
encidx, ENC_CODERANGE(v), NULL);
|
||||
rb_str_buf_append(str, v);
|
||||
if (encidx != ENCINDEX_US_ASCII) {
|
||||
if (ENCODING_GET_INLINED(str) == ENCINDEX_US_ASCII)
|
||||
rb_enc_set_index(str, encidx);
|
||||
|
|
Загрузка…
Ссылка в новой задаче