Issue #11473 has been updated by mame (Yusuke Endoh).


I'm still against frozen-string-literal by default.  It is arguable if the string creation limits performance so much in real-world programs.  We need to first measure how much Ruby can be faster by frozen-string-literal.  If it is not significant, Ruby should prefer dynamics and flexibility.


I'd like to share one interesting example.  RDoc has used `frozen-string-literal: true` since Ruby 2.5.0.  At the release, NEWS said "This (frozen-string-literal) reduces document generation time by 5%."  However, it turned out to be wrong.
There were originally some code fragments in RDoc assuming that a string is mutable.  To enable frozen-string-literal, they were changed, which brought performance degradation.  After that, enabling frozen-string-literal made RDoc a bit faster, but the net result was worse than the original.

* original rdoc: 79.5 sec
* code-changed rdoc: 81.3 sec
* frozen-string-literal rdoc: 80.0 sec

@aycabta performed a great postmortem examination.  See https://gist.github.com/aycabta/abdfaa75ea8a6877eeb734e942e73800 in detail.

By the way, RDoc's generation time is now about half by some algorithmic improvements.  In RDoc case, it is not significant whether string literals are frozen or not.

----------------------------------------
Feature #11473: Immutable String literal in Ruby 3
https://bugs.ruby-lang.org/issues/11473#change-81647

* Author: ko1 (Koichi Sasada)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
Matz said "All String literals are immutable (frozen) on Ruby 3".

This ticket is place holder to discuss about that.




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>