Project

General

Profile

Actions

Bug #9079

closed

Interpolated Symbol creates unnecessary intermediate String on the heap

Added by wycats (Yehuda Katz) about 11 years ago. Updated over 5 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.0.0p343 (2013-10-31) [x86_64-linux]
Backport:
[ruby-core:58159]

Description

This case:

x = "world"
y = :"hello#{world}!"

allocates one T_STRING according to ObjectSpace.count_objects. Since all of the concatenation happens as part of the symbol generation, it shouldn't be necessary to create a Ruby string.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0