From: WATANABE Hirofumi Date: 2002-12-05T20:14:59+09:00 Subject: Re: speeding up ... Mark Probert writes: > My question is this: 30% of the time is spent in Array#each. Is there any > way to speed this up and still keep some semblance of readability? Don't use Arrary#each. #! /usr/bin/ruby # if ARGV.size != 1 puts "usage: #{$0} " exit(1) end f = File.open(ARGV[0]){|fh| fh.read} nl = f.count("\n") nw = f.tr_s("^\t\n\v\f\r ", "x").count("x") nc = f.size puts " #{nl} #{nw} #{nc} #{ARGV[0]}" -- eban