Yeah the new systems have much better performance on it.  It's not needed in
the framework though and it's a slowdown in 1.8.6, so it's not there.

If you want it use it, but it's not used inside merb.

Cheers

On Mon, Feb 2, 2009 at 10:47 AM, Jacques Crocker <[email protected]> wrote:

>
> Hah.. good catch! Thanks for the tip :-)
>
> Here's the new results:
>
> With to_proc shorthand:
> real    0m1.449s
> user    0m1.335s
> sys     0m0.033s
>
> Without to_proc shorthand:
> real    0m0.376s
> user    0m0.347s
> sys     0m0.016s
>
> Also ran it on 1.9.1. Seems to run exactly the same speed both ways.
>
> With to_proc shorthand:
> real    0m0.204s
> user    0m0.172s
> sys     0m0.014s
>
> Without to_proc shorthand:
> real    0m0.201s
> user    0m0.180s
> sys     0m0.013s
>
> I do sorta prefer the shorthand to_proc syntax. I'll probably start
> using it more often since the performance difference on it isn't too
> bad anymore, and looks to become increasingly irrelevant as Ruby 1.9
> and 2.0 come out.
>
>
> On Feb 1, 3:35 pm, jonuts <[email protected]> wrote:
> > Why are you redefining Symbol#to_proc? It's a core method in 1.8.7
> >
> > On Feb 2, 1:25 am, Jacques Crocker <[email protected]> wrote:
> >
> > > 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