From: Aaron Smith Date: 2007-03-11T08:08:32+09:00 Subject: Re: OpenStruct,, know what keys are set Robert Klemme wrote: > On 10.03.2007 17:54, Aaron Smith wrote: >>> >> >> end >> x.report("Find all keys 3"){lady.keys_added} >> >> >> OUTPUT: >> user system total real >> Find all keys 1 0.000000 0.000000 0.000000 ( 0.000077) >> Find all keys 2 0.000000 0.000000 0.000000 ( 0.000014) >> Find all keys 3 0.000000 0.000000 0.000000 ( 0.000017) >> Find all keys 4 0.000000 0.000000 0.000000 ( 0.000016) >> > > You should add iterations to the blocks - otherwise the figures are > pretty uninformative. :-) Using bmbm (with rehearsal) might also be a > good idea. > > Kind regards > > robert Or if you change the amount of cats the lady has, from 10 to 100000. then you'll see something more: lady = OpenStruct.new 0.upto(100000) do |i| eval("lady.cat#{i} = i") #puts eval("lady.cat#{i}") end i'll add iterations to the blocks as well. -- Posted via http://www.ruby-forum.com/.