Hello:
We're having a little shoot out here at work with Ruby, Perl and Tcl.
So far, Ruby kicked on a recursive Fibonacci(sp?) sequence with
Perl about 50% slower and Tcl 10x slower.
Next we're looking at IO. So far, Perl is about as fast
as cp and Ruby is 50% slower and consumes over twice the
CPU (see table below):
ruby 60.07u 21.32s 1:31.62 88.8%
cp 0.01u 6.64s 0:53.34 12.4%
perl 16.79u 7.66s 0:58.76 41.6%
Oh, the Tcl results? The code is still being written. :)
The Ruby code is below. I know there have been multiple
posts on ruby-talk about this with discussions about
sysread and read, but not being an IO expert, I have
only been able to follow these at a high level.
Could some expert look at the code below and tell me
what could be done to speed up the code below. Possibly
using #read or #sysread. Or, if someone has some ruby C
code, that would be cool.
#------ rw.rb
file = ARGV.shift
File.open(file + ".out", "w") { |of|
File.open(file).each {|line|
# do processing here
of.print line
}
}
#-------
Thanks
--
Jim Freeze
----------
Different all twisty a of in maze are you, passages little.