Monday, October 10, 2016

Diving into How Hashes Work in Ruby

Ruby's Hash is arguably the most useful data type in the language. Utilizing a structure that lends itself well to modelling real-world problems, combined with speedy lookups, it is frequently the backbone of scripts, web pages, and complex business logic. It was even once used internally by Ruby to store all your functions, variables, and constants (although modern Ruby approaches this differently by using branch prediction of hot paths and call-site method caching; that's another post!) We often take it for granted that it "just works". Today we're going to delve into the internals of Hash, seeing exactly why it works, how it is so efficient, and how it is implemented. Onward!

Continue reading %Diving into How Hashes Work in Ruby%


by David Bush via SitePoint

No comments:

Post a Comment