From: Wilson Bilkovich Date: 2006-02-19T10:30:39+09:00 Subject: Re: metakoans.rb (#67) On 2/18/06, Timothy Goddard wrote: > To take the focus off number of lines, let's take a look at bechmarks. > This was my benchmark script: > > Benchmark::bm(12) do |x| > x.report('attr') {100000.times {c = Class.new {attr :foo, :bar}}} > x.report('attribute') {100000.times {c = Class.new {attribute :foo, > :bar}}} > end > > And my results were: > > user system total real > attr 3.720000 0.000000 3.720000 ( 3.724316) > attribute 25.750000 0.000000 25.750000 ( 25.790665) > > It isn't that efficient, but I'd like to see how it compares. > That's interesting. I didn't expect the difference to be quite this big. attr is impressively fast. user system total real attr 7.250000 0.000000 7.250000 ( 7.250000) attribute 30.110000 0.000000 30.110000 ( 30.172000) I'm looking forward to seeing some of the other solutions, for sure. I had my hands halfway around a faster way, but couldn't quite make it work.