From: dmertz@... (denis) Date: 2004-07-16T01:32:17+09:00 Subject: Re: my ruby code won't go as fast as my perl code "Dave Burt" wrote in message news:... > > The main slow bit seems to be the string concatenation and comparison > (...+$4+$5+$6 >= start_date). > You could try this one also (with String Arrays): # [yy, yy, mm, dd, hh, mm, ss] as strings start_date = %w{20 04 00 00 00 00 00} . . . ([$3>='87'?'19':'20', $3, mm[$2], $1, $4, $5, $6] >= start_date) Converting to integers could also help (integer comparison maybe faster than string comparison) mm = Hash.new i = 0 # integer here %w(JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC).each do |mmm| mm[mmm] = i = i.succ end #[yy, yy, mm, dd, hh, mm, ss] as integers start_date = [20, 04, 0, 0, 0, 0, 0] . . . d3 = $3.to_i ([d3>=87?19:20, d3, mm[$2], $1.to_i, $4.to_i, $5.to_i, $6.to_i] >= start_date)