Browse files

Cache #implemented_methods to reduce overhead to closer to 10%.

  • Loading branch information...
1 parent 2b057f3 commit dd315b49e6de1cd2d28edb949363cd0d19ea3bae @xaviershay committed Jul 4, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/rspec/fire.rb
View
4 lib/rspec/fire.rb
@@ -148,7 +148,9 @@ def with_doubled_class
protected
def implemented_methods(doubled_class, checked_methods)
- doubled_class.send(checked_methods)
+ @@_implemented_methods_cache ||= {}
+ @@_implemented_methods_cache[[doubled_class, checked_methods]] ||=
+ doubled_class.send(checked_methods)
end
def unimplemented_methods(doubled_class, expected_methods, checked_methods)

0 comments on commit dd315b4

Please sign in to comment.