From: Jim Freeze Date: 2003-04-11T02:29:24+09:00 Subject: Re: Need IO Optimization help On Friday, 11 April 2003 at 2:16:50 +0900, Yukihiro Matsumoto wrote: > Hi, > > In message "Need IO Optimization help" > on 03/04/11, Jim Freeze writes: > > |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. > > Which version of Ruby are you using? Can you show us the whole > scripts? > Sure: ruby -v ruby 1.8.0 (2003-04-10) [sparc-solaris2.8] #- ruby file = ARGV.shift File.open(file + ".out", "w") { |of| File.open(file).each {|line| of << line } } #--- #- tcl set inFileName [lindex $argv 0] set ifid [open $inFileName r] set ofid [open ${inFileName}.out w] while { ! [eof $ifid] } { gets $ifid newLine puts $ofid $newLine } close $ifid close $ofid #--- #- perl $file=shift; open( inFile, "+<$file"); open(outFile, "+>${file}.out"); while (){ print outFile $_; } #----- rubyprint 60.07u 21.32s 1:31.62 88.8% ruby<< 58.30u 21.13s 1:30.41 87.8% cp 0.01u 6.64s 0:53.34 12.4% perl 16.79u 7.66s 0:58.76 41.6% tcl 226.49u 8.74s 4:17.72 91.2% tclcp 0.21u 7.80s 1:17.81 10.2% rubysys 1.46u 12.18s 1:16.28 17.8% -- Jim Freeze ---------- Computers are not intelligent. They only think they are.