> Some robustness notes:
>
> On 5.2MB file, it takes 9s compared to 7s of improved Mibu version, or
> 7s of mine initial one.
>
> On 38MB file, it takes 53s and about 270MB of memory. Similarly, the
> initial one and the mibu versions take 39s and also about 270MB of
> memory. I also like Ipetit code, except it needs 60s and 530MB RAM.

On 5.2MB file, inoptimal but clever ruby version, based on group_by,
takes more than 10 minutes to finish:

require 'activesupport'

def top_words( in_filepath, out_filepath )
  words = File.read( in_filepath ).split.group_by { |word| word }
  words = words.map { |k, v| [v.length, k] }.sort.reverse
  File.open( out_filepath, "wb" ) do |f|
    words.each { |w| f.puts( "%20s : %7d\r\n" % [w[1], w[0]] ) }
  end
end

http://pastie.org/347385


regards,
Piotrek
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to