From: Paris Sinclair Date: 2005-01-23T19:12:04+09:00 Subject: Re: looking at ruby... On Sun, 23 Jan 2005, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: looking at ruby..." > on Sun, 23 Jan 2005 18:43:10 +0900, Paris Sinclair writes: > > |Since normally these are used for data structures not just strings, I would > |say, Storable is slow, and Marshal is twice as slow. > > On your machine. I got > > # time 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,rand,rand])))} } }; print time - $start' > 1 > real 0m0.943s > user 0m0.900s > sys 0m0.005s > > # time ruby -e 'foo = []; start = Time.new ; (0...100).each { |i| foo[i] = [] ; (0...100).each { |j| foo[i][j] = Marshal.load(Marshal.dump([rand,rand,rand])) } } ; puts Time.new - start' > 0.371891 > > real 0m0.379s > user 0m0.334s > sys 0m0.004s > > on my Linux box (Pentium M 1.6MHz). > > matz. Ah! Yes. I ran mine on an AMD K6-2/400 running RedHat 7.2, perl 5.8.0 and ruby 1.8.1 When I run it through time like that, it also showed Ruby as much faster because of perl's compile time. I was trying to keep that out of the data, because when I am worried about performance it is usually web app so I would be running mod_perl. And for a non-web app, perlcc works really well now. But... I notice yours the ruby is much faster than even just the perl runtime. And on my server (P4/2G RedHat ES 3) I am getting perl: user 0m1.160s ruby: user 0m0.330s Maybe I botched my ruby compile on my slow box. :) I am glad it was my fault... YaY! Ruby! -- RubyPanther