On Dec 24 2007, 4:47 pm, MonkeeSage <MonkeeS... / gmail.com> wrote:
> On Dec 21, 6:38 am, MonkeeSage <MonkeeS... / gmail.com> wrote:
>
>
>
> > On Dec 17, 7:49 pm, MonkeeSage <MonkeeS... / gmail.com> wrote:
>
> > > Hmmm...another thing...passing prc to #explicit_blk as an lval rather
> > > than invoking block_pass shaves another second off the time...
>
> > > def explicit_blk(blk)
> > >   blk.call("baz")
> > > end
> > > n = 1_000_000
> > > prc = lambda { | y | y }
> > > Benchmark.bm(10) { | x |
> > >   x.report("explicit") { n.times { explicit_blk(prc) } }
>
> > > }
>
> > > # =>
> > >                 user     system      total        real
> > > explicit    5.030000   0.520000   5.550000 (  5.774020)
>
> > > ...so I'm curious about two matters:
>
> > > 1.) Why does creating a Proc explicitly and passing it as a block_arg
> > > rather than using a literal block (see previous post) speed up the
> > > #explicit_blk benchmark 2 times, but doesn't have very much effect the
> > > #implicit_blk benchmark?
>
> > > 2.) Why is it less expensive to pass a Proc as an lval rather than as
> > > a block_arg?
>
> > > Anybody know?
>
> > > Regards,
> > > Jordan
>
> > Bump
>
> Bump...anyone have any idea about the two questions I asked?

Bump again...