Please sign in to comment.
Improve pre-frozen string logic with a deduplication cache.
This commit brings our "str".freeze compiler optimization in line with MRI by using a global deduplication cache to provide for even more sharing across literals. The cache is both weak-keyed and weak-valued and just maps from an arbitrary RubyString to the pre-frozen cached version of that RubyString. Note that the logic for deduplication is synchronized against the JRuby runtime. This will impact concurrent loads that repeatedly ping the cache, but uses in this commit all cache the value locally and only hit the dedup cache once. This potential concurrency bottleneck may need to be addressed in the future.
- Loading branch information...
Showing with 45 additions and 2 deletions.