Ralf Mler wrote: >tried with Hash instead of Array: >ram@lilith:~/src/ruby$time ruby -e 'str=STDIN.gets; h=Hash.new(); (0..9).each >{|i| h[i.to_s] = 0}; (0..str.length-1).each {|i| h[str[i..i]] += 1 }; h.each >{|k,v| print "#{k} #{v}\n"} ' < pi.out | sort > > why@stungun$ time ruby -n -e 'c={};$_.each_byte{|b|c[b]||=0; c[b]+=1}; c.sort.each {|k,v| puts "#{k - ?0} #{v}"}' < pi.out 0 3454 1 3514 2 3358 3 3452 4 3483 5 3510 6 3488 7 3431 8 3482 9 3464 real 0m0.052s user 0m0.051s sys 0m0.000s same idea as yours. just runs 3x swift. _why