Eric Hodel
9/20/2007 11:17:00 PM
On Sep 20, 2007, at 15:44, SpringFlowers AutumnMoon wrote:
> Eric Hodel wrote:
>> What program?
> How about something just like:
>
> on my Mac, the 1.8.2 runs about 46% faster than 1.8.6
>
> [...]
>
> print "Ruby ", RUBY_VERSION, " patch ", RUBY_PATCHLEVEL, " on ",
> RUBY_PLATFORM
This program doesn't run on ruby 1.8.2, there is no RUBY_PATCHLEVEL.
$ /usr/bin/ruby -ve 'RUBY_PATCHLEVEL'
ruby 1.8.2 (2004-12-25) [universal-darwin8.0]
-e:1: warning: useless use of a constant in void context
-e:1: uninitialized constant RUBY_PATCHLEVEL (NameError)
I used this one, which seems to be the core of it:
for i in 1..1_000_000
t = (1..10).inject {|x, y| x + y }
end
And I got opposite results:
$ pbpaste | time ruby -v -
ruby 1.8.6 (2007-06-30 patchlevel 5000) [i686-darwin8.10.1]
12.37 real 12.29 user 0.01 sys
$ pbpaste | time /usr/bin/ruby -v -
ruby 1.8.2 (2004-12-25) [universal-darwin8.0]
16.23 real 16.13 user 0.02 sys
1.8.6 is 24% faster in this test.
and for what its worth:
$ pbpaste | time ruby19 -v -
ruby 1.9.0 (2007-09-15 patchlevel 0) [i686-darwin8.10.1]
syck.so: warning: method redefined; discarding old value
3.57 real 3.50 user 0.01 sys
--
Poor workers blame their tools. Good workers build better tools. The
best workers get their tools to do the work for them. -- Syndicate Wars