From: Jan Friedrich Date: 2008-06-11T17:04:49+09:00 Subject: Re: [ANN] Bench 1.0.0 released Ryan Davis wrote: > If I don't remember how to use the benchmark library, why would I > remember how to use your DSL? Because it has only 2 commands: benchmark and run. ;) > That is what ri is for. `ri Benchmark` obviates the need for Bench. Maybe, but with bench it's a pleasure to doing benchmarks interactive with irb: >> require 'bench' >> benchmark 'simple' do ?> /ll/ =~ 'hello world' >> end >> benchmark 'freezed' do ?> /ll/.freeze =~ 'hello world' >> end >> run 1000 user system total real simple 0.000000 0.000000 0.000000 ( 0.003960) freezed 0.010000 0.000000 0.010000 ( 0.004870) >> run 1000 user system total real simple 0.010000 0.000000 0.010000 ( 0.003969) freezed 0.000000 0.000000 0.000000 ( 0.004624) >> # let's try more iterations ?> run 10000 user system total real simple 0.060000 0.000000 0.060000 ( 0.058049) freezed 0.060000 0.000000 0.060000 ( 0.058636) >> run 100000 user system total real simple 0.500000 0.000000 0.500000 ( 0.502427) freezed 0.540000 0.000000 0.540000 ( 0.533421) >> # now another benchmark sample ?> RE = /ll/ >> benchmark 'constant' do ?> RE =~ 'hello world' >> end >> run user system total real simple 0.000000 0.000000 0.000000 ( 0.000031) freezed 0.000000 0.000000 0.000000 ( 0.000469) constant 0.000000 0.000000 0.000000 ( 0.000031) But It's certainly a question of taste. :) Regards, Jan Friedrich