Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Performance improvements.
- Loading branch information
Brian Takita
committed
Jan 17, 2009
1 parent
ddd7123
commit 4267b53
Showing
4 changed files
with
63 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
dir = File.dirname(__FILE__) | ||
require File.expand_path("#{dir}/../lib/rr") | ||
require "benchmark" | ||
|
||
o = Object.new | ||
|
||
Benchmark.bm do |x| | ||
x.report do | ||
1000.times do | ||
RR.mock(o).foobar.returns("baz") | ||
o.foobar | ||
RR.reset | ||
end | ||
end | ||
end | ||
|
||
#require "ruby-prof" | ||
#RubyProf.start | ||
# | ||
##RR.mock(o).foobar.returns("baz") | ||
##o.foobar | ||
#250.times do | ||
# RR.mock(o).foobar.returns("baz") | ||
# o.foobar | ||
# RR.reset | ||
#end | ||
# | ||
#result = RubyProf.stop | ||
# | ||
## Print a flat profile to text | ||
#printer = RubyProf::FlatPrinter.new(result) | ||
#printer.print(STDOUT, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require "rubygems" | ||
require "spec/mocks" | ||
require "benchmark" | ||
|
||
o = Object.new | ||
|
||
Benchmark.bm do |x| | ||
x.report do | ||
1000.times do | ||
o.should_receive(:foobar).and_return("baz") | ||
o.foobar | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters