Skip to content
  • Jean Boussier's avatar
    1b830740
    compile.c: use rb_enc_interned_str to reduce allocations · 1b830740
    Jean Boussier authored
    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.
    1b830740
    compile.c: use rb_enc_interned_str to reduce allocations
    Jean Boussier authored
    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.
Loading