From: Chris Carter Date: 2007-07-08T02:42:49+09:00 Subject: Re: flatulent-0.0.3 On 7/7/07, ara.t.howard wrote: > > On Jul 7, 2007, at 11:25 AM, Chris Carter wrote: > > > Ara, > > That is because you set defl and flat inside a block, without setting > > the variables to nil before the block is executed, so they stay > > existing for the actual decode stage. > > > > ?? > > # defl = html = code = nil ### irrelevant > pairs = Array.new(200) > > GC.disable > i = 0 > > begin > Benchmark.bm(13) do |x| > i += 1 > defl = html = code = nil ### irrelevant > x.report("generate:") { flat = Flatulent.new; html = flat.form; > code = flat.string } > x.report("setup:") { defl = Deflatulent.new } > x.report("break:") { raise "failed on attempt #{ i }" unless > defl.deflatulent(html) == code } > x.report("generate 200:") { 200.times{|index| flat = > Flatulent.new; pairs[index] = [flat.form,flat.string] } } > x.report("break 200:") { pairs.map{|(html,code)| raise unless > defl.deflatulent(html) == code } } > end > ensure > puts "Flatulent.version : #{ Flatulent.version }" > end > > > > it fails on the very first attempt: > > > cfp:~ > ruby a.rb > user system total real > generate: 0.140000 0.020000 0.170000 ( 0.179983) > setup: 0.020000 0.000000 0.020000 ( 0.022315) > break: Flatulent.version : 0.0.4 > a.rb:64: failed on attempt 1 (RuntimeError) > from /opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure' > from /opt/local/lib/ruby/1.8/benchmark.rb:377:in `report' > from a.rb:64 > from /opt/local/lib/ruby/1.8/benchmark.rb:177:in `benchmark' > from /opt/local/lib/ruby/1.8/benchmark.rb:207:in `bm' > from a.rb:59 > > > cheers. > > > -a > > Huh, I guess I am blind then... -- Chris Carter concentrationstudios.com brynmawrcs.com