[rspec-users] != again

Matthias Hennemeyer mhennemeyer at googlemail.com
Sun Jun 1 15:17:12 EDT 2008


I have implemented a quick solution for the should != .. , should ! 
~ ... 'problem'.
It uses source code inspection (I think it's the only way) and i've  
done some
benchmarking to see if it's really that slow.

A direct comparison of
running '1.should == 1'
with the unmodified rspec source against the rspec-version with  
source inspect
shows that the latter is 7 times slower ... :(

But benchmarks with '1.should == 1' inside a real example file are   
showing 'only'
an overall speed decrease of 15% to 50%. That is still bad but having  
lots of people
consider the passing of '1.should != 1'  an rspec bug is bad too.

Here is the benchmarking script:

And the code is at branch 'inspect' in:

There are examples for should and should_not != and !~ and i will
definitely work on performance if you not totally reject this whole  


More information about the rspec-users mailing list