Stevedore is a tool for performing and comparing sets of benchmarks based on similar setup and teardown needs. Instances use their class's setup/teardown where available, and you can set or override these methods per instance.

Steve (and his subclasses, naturally) track any instances created and can run a comparison using Steve.compare_instances. If the R language is available, you can do a power analysis using the data from a trial run to suggest sample sizes and number of runs needed to meet certain figures of statistical reliability.

Steve uses the rsruby gem, if available, for basic stats and power analysis. As the rsruby gem uses a C extension, this could be problematic for non-MRI Rubys. In the absence of rsruby, stevedore uses bmarini-mathstats for the basic stats and attempts to shell out to R for power analysis (i.e. power.t.test)

```
class StringConcat < Stevedore
before_sample do
...
end
after_sample do
...
end
end
plus = StringConcat.new "Combining strings with +" do
measure do
10000.times do
"supercalifragilisticexpiali" + "docious"
end
end
end
append = StringConcat.new "Combining strings with <<" do
measure do
10000.times do
"supercalifragilisticexpiali" << "docious"
end
end
end
interpolate = StringConcat.new "Combining strings with interpolation" do
measure do
10000.times do
"supercalifragilisticexpiali#{'docious'}"
end
end
end
run_count, sample_size = 3, 8
puts "Measuring #{run_count} runs of #{sample_size} for each test."
StringConcat.run([append, interpolate], run_count, sample_size)
puts
StringConcat.report([append, interpolate]) => putses the following:
Combining strings
Mean Stddev Minimum Median Max
--------------------------------------------------------------------------------------
interpolating strings 0.003064 0.002386 0.001356 0.001682 0.008544
appending strings 0.009267 0.002933 0.005337 0.010756 0.013299
Ratio of means: 3.02487110476993
```