From: naruse@... Date: 2020-09-04T10:43:48+00:00 Subject: [ruby-core:99921] [Ruby master Feature#17147] New method to get frozen strings from String objects Issue #17147 has been updated by naruse (Yui NARUSE). Status changed from Open to Closed The feature is provided by `-str`. ---------------------------------------- Feature #17147: New method to get frozen strings from String objects https://bugs.ruby-lang.org/issues/17147#change-87455 * Author: tagomoris (Satoshi TAGOMORI) * Status: Closed * Priority: Normal ---------------------------------------- Object deserializer (like JSON, MessagePack) instantiates many String objects (as keys of Hash objects), and many of those are in a set of names. (So the total number of keys is not infinite.) In such use-case, the object deserializer is generating many string object instances. Those are impacting the VM performance (mainly for GC pressure), especially in the case when those objects keep staying in memory for a long time. If we can de-duplicate those instances at the instantiation, we can reduce the performance impact of object instantiation. It can be achieved if we have C API to generate frozen strings. On the other hand, if we have Ruby methods to get frozen strings from strings, we can implement object deserializer in Ruby. It should be valuable for many Ruby users because of MJIT optimization in the future (And that method can be used from C ext modules too). So, in general, a Ruby method to get frozen (de-duplicated) strings will be valuable and can improve the Ruby performance so much. Deserializers (JSON, MessagePack) are used everywhere. -- https://bugs.ruby-lang.org/ Unsubscribe: