You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Working with rspec-benchmark I've noticed that the execution time matchers seem to add a lot of overhead to execution time, which results in really slow tests.
For instance:
require"spec_helper"describe"rspec-benchmark"doit"runs a benchmark"doBenchmark.bmdo |x|
x.report("Benchmark"){expect(Benchmark.realtime{sleep1}).tobe < 1.5}x.report("rspec-benchmark"){expect{sleep1}.toperform_under(1500).ms}endendend# user system total real# Benchmark 0.000181 0.000140 0.000321 ( 1.003005)# rspec-benchmark 0.509193 0.073387 0.582580 ( 2.654598)
This gets especially bad when running with multiple samples:
require"spec_helper"describe"rspec-benchmark"doit"runs a benchmark"doBenchmark.bmdo |x|
x.report("Benchmark")dotime=Benchmark.realtime{100.times{sleep0.01}}expect(time).tobe < 1.5endx.report("rspec-benchmark")doexpect{sleep0.01}.toperform_under(1500).ms.sample(100).timesendendendend# user system total real# Benchmark 0.000858 0.002123 0.002981 ( 1.137361)# rspec-benchmark 18.660885 0.139979 18.800864 ( 19.985222)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Working with rspec-benchmark I've noticed that the execution time matchers seem to add a lot of overhead to execution time, which results in really slow tests.
For instance:
This gets especially bad when running with multiple samples:
Is this intended behaviour?
Beta Was this translation helpful? Give feedback.
All reactions