summaryrefslogtreecommitdiff
path: root/include/ruby/random.h
diff options
context:
space:
mode:
authorJean Boussier <byroot@ruby-lang.org>2024-04-11 12:47:49 +0200
committerJean Boussier <jean.boussier@gmail.com>2024-04-11 14:48:30 +0200
commitdb0cf1aef92efc558d4d6c6351dee9e45ef31005 (patch)
treed74e477b011d481ad3e129d8644a33085bd6ba2f /include/ruby/random.h
parent56f9ac8d31766426471aca3c8180defeba0c2fd0 (diff)
prism_compile.c: use rb_enc_interned_str to reduce allocations
The `rb_fstring(rb_enc_str_new())` pattern is inefficient 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/random.h')
0 files changed, 0 insertions, 0 deletions