[rspec-users] auto-generated descriptions

Ben Mabey ben at benmabey.com
Fri Jul 4 22:32:06 EDT 2008

David Chelimsky wrote:
> Hey all,
> I'm looking for ways to optimize rspec and came upon something 
> interesting. If I remove handling for auto-generated descriptions (the 
> thing that allows you to say "specify { 5.should == 5 }" with no 
> description string) we get an average 35% performance increase per 
> expectation. 35%. That's huge.
> So - how bad do you think this would suck to remove that feature? Are 
> you using it yourself?
> All thoughts welcome.
> Thanks,
> David
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

I personally like that feature, but I honestly don't find myself using 
it too much.  35% is a lot.

One suggestion would be to keep the functionality but move it to a 
different keyword so that the common "it"/"specify" case is made 
faster.  That way we could have our cake and eat it too.  I'm not too 
sure on what keyword could be used though.  "Expect" comes to mind but I 
think that is because of Jay Fields expectations framework.  Which, BTW, 
if we added support for that to coexist within rspec example groups then 
the need for rspec to support the feature natively would diminish.  So 
that is another option that may be worth investigating.

Could you maybe post the diff of your changes to turn off that feature?  
I'd be interested in seeing how much speed improvements I get with my 
slower spec suites.


More information about the rspec-users mailing list