From: murphy Date: 2007-07-07T20:05:16+09:00 Subject: Re: Optimizing Symbol#to_proc > I don't what the "old Ruby version" was, but I tried to implement mine and > to my surprise my custom version is *much* faster. Does anybody know why ? Yes. Your version doesn't handle multiple arguments like the Ruby 1.9 version does. enjoy Haskell-style folding: [1, 2, 3].inject(&:+) #=> 6 This ongoing discussion about a Rails ticket was the source of my question: http://dev.rubyonrails.org/ticket/8818 lifofifo provides benchmarks for Ruby 1.8/1.9 and some versions of Symbol#to_proc there. To sum it up, it seems that the arguments in the call are the key, not whether it is implemented in C or Ruby. - calling a proc with one parameter is fast - calling a proc with a catch-all parameter is slow So Symbol#to_proc could be much faster for the common case (one argument). But cutting the power of a feature only for performance reasons is sad. My question to those who understand the core and the new VM better than me is: * Is it possible to handle :&x faster without restricting it to one argument? It wouldn't be very nice to present a great new addition to the Ruby slang and warn about it being slow at the same time ;) [murphy]