The Value of Being Lazy, or How I Made OpenStruct 10X Faster

The OpenStruct class was written by Matz in 1998 and has been part of the standard library since Ruby 1.2. The idea behind OpenStruct—a data structure that provides method access to arbitrary attributes—is broadly useful, for example, to interact with API responses or as a test double. However, use of metaprogramming to dynamically define attribute methods at runtime made OpenStruct slow.
Length: 36:35
Views 171 Likes: 8
Recorded on 2015-11-24 at Rails Israel
Look for other videos at Rails Israel.
Tweet this video