On 22 Jan 2005, at 20:03, Sean T Allen wrote: > 6. Marshalling speed... perl has the Storable module which alas is a tad > slow... > how does ruby do in this area? I am new to Ruby, coming from the Perl (99% Perl for the last 5 years, until in October when I realized, oh Ruby has English docs these days :))))) so I don't know if I totally botched these benchmarks, because I know pretty much ZERO about Ruby internals and optimizations... and about half the attempts at benchmarks in Perl I've seen have been incorrect due to compiler optimization. But this is my quick little attempt to compare Perl's Storable to Ruby's Marshall. Yes, I know it is a bad benchmark, please don't cite this anywhere. :) it is just for, drinking a beer saturday night, and wondering also about the speed of this new love in my life, Ruby, compared to my dear but scatterbrained ex, Perl. But do tell if anybody knows of optimizations defeating it. At first I did use the Perlish foreach instead of the C-ish for(;;), but I knew just waiting for the results (having run the Ruby version first) that the ruby iterations were better optimized. But even having uglified the Perl to speed it up, I haven't compared just the iteration speeds. Like I said, it is a "bad" benchmark. But it is maybe more like the real world that a formal benchmark? perl -MStorable='freeze,thaw' -e '$start = time; for($i=0;$i<100;$i++) { for($j=0;$j<100;$j++) { $foo[$i][$j] = ${thaw(freeze(\(rand)))} } }; print time - $start' 14 ruby -e 'foo = []; start = Time.new ; (0...100).each { |i| foo[i] = [] ; (0...100).each { |j| foo[i][j] = Marshal.load(Marshal.dump(rand)) } } ; puts Time.new - start' 1.269654 It is such a difference, I can't imagine... that I didn't short circuit the Ruby loop? I love Ruby, I want it to be fast, but this is ridiculous, somebody tell me I am just drunk. As far as aethetics go... before when I have looked at Perl, it has always looked beautiful, because of it's strength and freedom. C, Java, Python, LISP... all have been ugly in my eyes. But now that I have found Ruby, I understand, Perl is a bit homely, yes. Still though, she is the second hottest language I have spent the night with. -- RubyPanther