Hello Daniel,

Thursday, February 20, 2003, 9:13:16 AM, you wrote:

>> TW> # This is ran about a million times
>> TW> h = Hash.new(0)
>> TW> data.scan(iptok).each do |tok|
>> TW>   h[tok] += 1
>> TW> end
>> 
>> are you heard about "sort|uniq" idiom?

DC> I still think that using C is a good idea.

sorry, i don't seen that your are not Travis :)

i think that better way to speed up this code is:

h = data.scan(iptok).sort.uniqc.to_hash

where
Array#to_hash - reverse operaqion to Hash#to_a
Array#uniqc - gets sorted array of items and returns array of pairs [item, count]

and these two methods must be included in Ruby itself, because they support
very widespread programming idioms

-- 
Best regards,
 Bulat                            mailto:bulatz / integ.ru