How Ruby Encodes References - Ruby Tiny Objects Explained
05-Sep-2019 1578
When you’re using Ruby and you care about performance, you’ll hear a specific recommendation: “use small, fast objects.” As a variation on this, people will suggest you use symbols (“they’re faster than strings!”), prefer nil to the empty string and a few similar recommendations.It’s usually passed around as hearsay and black magic, and often the recommendations are somehow wrong. For instance, some folks used to say “don’t use symbols! They can’t be garbage collected!”. But nope, now they can be. And the strings versus symbols story gets a lot more complicated if you use frozen strings….
How Ruby Encodes References - Ruby Tiny Objects Explained #ruby #rubydeveloper #rubyonrails #Encodes #References #Objects #Explained https://rubyonrails.ba/link/how-ruby-encodes-references-ruby-tiny-objects-explained