The Value of Being Lazy, or How I Made OpenStruct 10X Faster
Rails Israel 2015 Conference, Tuesday, November 24, 2015, 09:25
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.
I will describe how I was able to optimize OpenStruct to be 10X faster by defining attribute methods lazily. These changes will ship later this year in Ruby 2.3.
Other Presentations at Rails Israel 2015
-
Tuesday, November 24, 2015, 08:00
-
Tuesday, November 24, 2015, 16:00
-
Tuesday, November 24, 2015, 12:35
-
Tuesday, November 24, 2015, 08:05
-
Tuesday, November 24, 2015, 16:05
-
Tuesday, November 24, 2015, 13:05
-
Tuesday, November 24, 2015, 08:45
-
Tuesday, November 24, 2015, 16:10
-
Tuesday, November 24, 2015, 13:35
-
Tuesday, November 24, 2015, 16:15
-
Tuesday, November 24, 2015, 16:20
-
Tuesday, November 24, 2015, 14:30
-
Tuesday, November 24, 2015, 10:25
-
Tuesday, November 24, 2015, 15:00
-
Tuesday, November 24, 2015, 10:55
-
Tuesday, November 24, 2015, 11:25
-
Tuesday, November 24, 2015, 11:55
-
Tuesday, November 24, 2015, 13:05
-
Tuesday, November 24, 2015, 13:35
-
Tuesday, November 24, 2015, 14:05
-
Tuesday, November 24, 2015, 15:00
-
Tuesday, November 24, 2015, 15:30