by codesnik · 6y ago · 0 comments
There're some actually exotic data structures, like pseudo-hashes. And perl can do this! $x = \$x
But having switched to ruby 15 years ago I never missed this particular quirk.
Copying (often happens when passing an arg to a function / class) a reference is much quicker (only a 4 or 8 byte copy depending on arch) than doing either a single level shallow copy (4 x length(array) or 8 x length(array) bytes). Obviously the larger the size of the array the larger the impact.