diff options
| author | Jean Boussier <byroot@ruby-lang.org> | 2024-04-10 10:50:18 +0200 |
|---|---|---|
| committer | Jean Boussier <jean.boussier@gmail.com> | 2024-04-11 09:04:31 +0200 |
| commit | 1b830740ba8371c4bcfdfc6eb2cb7e0ae81a84e0 (patch) | |
| tree | 7f4b1c983035adaaa52bf966e54f1f4738098d4c /include/ruby/internal/encoding | |
| parent | ed303cd56cfc7889ce371ee390e9fd36f86814ea (diff) | |
compile.c: use rb_enc_interned_str to reduce allocations
The `rb_fstring(rb_enc_str_new())` pattern is inneficient because:
- It passes a mutable string to `rb_fstring` so if it has to be interned
it will first be duped.
- It an equivalent interned string already exists, we allocated the string
for nothing.
With `rb_enc_interned_str` we either directly get the pre-existing string
with 0 allocations, or efficiently directly intern the one we create
without first duping it.
Diffstat (limited to 'include/ruby/internal/encoding')
0 files changed, 0 insertions, 0 deletions
