From: Daniel Berger Date: 2007-03-07T22:50:09+09:00 Subject: Re: A better benchmarking syntax (was: Automatic Benchmark Iterations) On Mar 7, 6:26 am, Daniel Schierbeck wrote: > Reading Phrogz' post about automatic benchmark iterations, and then > seeing Mauricios' lovely Adaptative Benchmark[1], I came to think we > might need a friendlier syntax for benchmarks all together. Minutes > later, I discovered that someone had almost the same idea as me[2]. > Anyway, I'd like to just throw it out here, and hear what you people > think. > > The idea is to make benchmarks syntactically similar to the current > Test::Unit test cases, e.g. > > class SortBenchmark < Benchmark > def setup > @array = [1, 6, 2, 9, 4, 6, 2] > end > > def teardown > @array = nil > end > > def report_quicksort > @array.quicksort > end > > def report_mergesort > @array.mergesort > end > end > > Automatic iteration could be added, either as a class method call or by > creating a different base class (IterativeBenchmark?) > > So, what do y'all think? If I'm not the only one liking this, I might > whip something up when I get some spare time... +1 - please do. :) Dan