Hey Jonuts. You sure they fixed it in 1.8.7? I'm still seeing 10x
slowdown on the to_proc shorthand with my 1.8.7 installation

With to_proc shorthand:
real    0m4.138s
user    0m3.893s
sys     0m0.066s

Without to_proc shorthand:
real    0m0.391s
user    0m0.350s
sys     0m0.015s

[...@macbookpro ~/Ruby/benchmarks]# ruby --version
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9]

Here's the code I'm using to benchmark: http://gist.github.com/56695

On Feb 1, 3:17 pm, jonuts <[email protected]> wrote:
> Just for the record, on ruby 1.8.7 I get (slow machine):
>
>       user     system      total        real
> sym#to_p  3.170000   0.510000   3.680000 (  3.710362)
> normal  2.450000   0.610000   3.060000 (  3.070118)
>
> There is really no reason not to use sym2proc if you're on 1.8.7+
>
> On Feb 2, 1:03 am, Daniel N <[email protected]> wrote:
>
> > Here's why it's not there:
>
> > class Foo
> >   def foo
> >     :foo
> >   end
> > end
>
> > @foos = [Foo.new] * 1_000_000
>
> > @foos.each(&:foo) vs @foos.each{|f| f.foo}
>
> >                     user           system      total            real
> > sym 2 proc  2.000000   0.020000   2.020000 (  2.093694)
> > raw ruby      0.330000   0.000000   0.330000 (  0.345703)
>
> > Cheers
> > Daniel
>
> > On Mon, Feb 2, 2009 at 9:57 AM, jonuts <[email protected]> wrote:
>
> > > D> run ruby 1.8.7
>
> > > On Feb 2, 12:45 am, Phlip <[email protected]> wrote:
> > > > Merbalists:
>
> > > > If I feel like using posts.map(&:name), leveraging the cute
> > > Symbol#to_proc trick
> > > > from both Rails and 'facets', what's the _most_supportable_ way to get
> > > it?
>
> > > >   A> stick all three lines at the bottom of config/init.rb?
> > > >   B> require 'facets'?
> > > >   C> require someone's merb-cute-hacks module from GitHub?
>
> > > > BTW, please debate whether Symbol#to_proc is better than sex, or the 
> > > > last
> > > bell
> > > > before the Apocalypse, in space provided: [___]. Please write legibly...
>
> > > > --
> > > >    Phlip
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to