From: Brian Mitchell Date: 2007-08-07T23:28:02+09:00 Subject: Re: continuations in Ruby 1.9? On 8/7/07, Koichi Sasada wrote: > Hi, > > Brian Mitchell wrote: > > Right now callcc seems to have a _large_ negative performance gap in > > regard to the 1.8 implementation (tested on OS X, I'll try another OS > > when I get a chance) so I am not sure I would use them in their > > current state. Are there plans to address performance (or am I the > > only one getting this problem)? > > Do you have any concrete data? I did some benchmarking on some machines I have access to. Here is what I get: $ cat callcc.rb require 'benchmark' N = 10_000 result = Benchmark.measure do N.times {callcc {|cc| cc}.call(lambda {|*| 42})} end puts RUBY_VERSION puts result On FreeBSD 6.2 amd64: $ ruby -v ruby 1.8.6 (2007-03-13 patchlevel 0) [amd64-freebsd6] $ ruby callcc.rb 1.8.6 0.164062 0.007812 0.171875 ( 0.178217) $ ruby19/bin/ruby -v ruby 1.9.0 (2007-08-07 patchlevel 0) [x86_64-freebsd6.2] $ ruby19/bin/ruby callcc.rb 1.9.0 15.226562 12.570312 27.796875 ( 55.368435) On Mac OS X (10.4.8): $ ruby -v ruby 1.8.5 (2006-08-25) [i686-darwin8.6.2] $ ruby callcc.rb 1.8.5 0.180000 0.010000 0.190000 ( 0.193483) $ bin/ruby -v ruby 1.9.0 (2007-08-07 patchlevel 0) [i686-darwin8.10.1] $ bin/ruby callcc.rb 1.9.0 11.230000 6.340000 17.570000 ( 21.121573) > BTW I think Ruby's continuation has lack of important features. I would be interested in hearing more about this. Is this related to the fibers underlying the current trunk implementation of callcc? Brian.