xaviershay/rspec-mocks — pull request #1 by xaviershay (2013-08-03 18:54:30+00:00)
Title: Improve performance of double creation.

A couple of optimisations that speed up double creation significantly. See individual commits for their contribution details.

Time to create 1000 doubles:

I just cranked away with benchmark and `ruby-prof` for a while, using code like the following:

``` Ruby
n = 1000
Benchmark.bm do |bm|
RSpec::Mocks.setup(self)

(0..9).each do |m|
attrs = m.times.inject({}) {|h, x|
h["method_#{x}"] = x
h
}

bm.report("double") do
n.times do
double(attrs)
end
end
end
end
```

**Notes**

* `caller` location has changed for `expected_from` definition. Pretty sure this isn't a problem.
* "simple stub" is a new concept, I believe it justifies itself in the speed improvement.
* Built on top of #378, so don't merge before that.
* Addresses #193.

R @myronmarston