This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "json" | |
require "tempfile" | |
require "set" | |
require "benchmark/ips" | |
# Welcome to the benchmarks for "Achieving Fast Method Metaprogramming: Lessons | |
# from MemoWise" by Jacob Evelyn and Jemma Issroff, presented at RubyConf 2021. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Example | |
prepend MemoWise | |
def slow_value | |
... | |
end | |
memo_wise :slow_value | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Example | |
def slow_value | |
@slow_value ||= begin | |
... | |
end | |
end | |
end |