[ 
https://issues.apache.org/jira/browse/THRIFT-5950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dmytro Shteflyuk reassigned THRIFT-5950:
----------------------------------------

    Assignee: Dmytro Shteflyuk

> Add frozen_string_literal to Ruby files to reduce allocations
> -------------------------------------------------------------
>
>                 Key: THRIFT-5950
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5950
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Ruby - Library
>            Reporter: Dmytro Shteflyuk
>            Assignee: Dmytro Shteflyuk
>            Priority: Major
>
> Ruby is moving toward a future where string literals are frozen by default, 
> but that transition is not complete yet. Per byroot’s October 28, 2025 
> write-up, the migration actually started in Ruby 3.4.0 with chilled strings, 
> not Ruby 4.0: when a file has no explicit {{# frozen_string_literal}} 
> comment, Ruby now marks literals in a way that supports deprecation warnings 
> as a step toward eventual default freezing.
> If we want the benefits today, enabling {{# frozen_string_literal: true}} is 
> the simplest and lowest-friction way to get them now. Frozen string literals 
> are strictly less work for the Ruby VM, because the compiler can reuse 
> literal strings directly instead of allocating mutable copies and defensively 
> duplicating them. That reduces object allocation and copying, removes the 
> need for many older {{.freeze}}-based workarounds, and can produce meaningful 
> performance gains in allocation-heavy code paths.
> h2. References
> * https://byroot.github.io/ruby/performance/2025/10/28/string-literals.html
> * https://github.com/rails/rails/pull/29506
> * https://github.com/rack/rack/pull/1250



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to