From: Charles O Nutter Date: 2006-09-30T00:30:52+09:00 Subject: Re: New magical version of Symbol.to_proc On 9/29/06, Dr Nic wrote: > > The magic dot has a potential to create scads more objects to handle > > the adapting. With a magic dot, list.map.to_i necessarily has to > > create some adapter object for the call to map so there's a receiver > > for to_i where no object was required before. Unless Ruby is adding a > > pretty powerful GC in the future, perhaps we should avoid adding tons > > of transient objects just for the magic dot. > > Perhaps the proxy could be associated with the class and reused? Threading, threading, threading...remember JRuby is native-threaded and Ruby 2.0 should be as well. Even if not native-threaded, a green-thread context switch could try to use it twice. And before someone suggests a "proxy pool", almost all benchmarks I've seen show that with a good GC, just creating transient objects is way faster than pooling. Of course, Ruby's GC is not on the same level as the JVM's, so a pool may be faster in Ruby's case. -- Contribute to RubySpec! @ www.headius.com/rubyspec Charles Oliver Nutter @ headius.blogspot.com Ruby User @ ruby.mn