[rspec-devel] [ rspec-Patches-13952 ] Fix for performance regression introduced in r2096

noreply at rubyforge.org noreply at rubyforge.org
Sat Sep 15 09:39:56 EDT 2007


Patches item #13952, was opened at 2007-09-15 07:05
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3151&aid=13952&group_id=797

>Category: mock module
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 3
Submitted By: Ian Leitch (idl)
>Assigned to: Aslak Hellesøy (aslak_hellesoy)
Summary: Fix for performance regression introduced in r2096

Initial Comment:
Bug report 11545 pointed out an issue where RSpec would attempt to proxy a method on an ActiveRecord class which lies about the presence of methods by overriding responds_to?.

The fix for that bug used a search on instance_methods to ensure the method actually exists, specifically: instance_methods.include?(sym.to_s). On my laptop, this introduced a 2x performance regression. As a result, my spec suite went from running in 20 seconds to 40.

This patch almost completely eliminates the overhead by using method_defined? instead.

Cheers
Ian Leitch

P.S svn _badly_ needs an equivalent of git bisect! 

----------------------------------------------------------------------

>Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2007-09-15 09:39

Message:
Thanks! Applied in r2096

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3151&aid=13952&group_id=797


More information about the rspec-devel mailing list