From: Josh Cheek Date: 2009-08-20T03:17:53+09:00 Subject: Re: Confirm my Performance Test Against Java? --000e0cd25d822eb072047182a715 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit A version of Mike Sassak's gist start = Time.now printf "Starting to read file ...\nThe number of tokens is: %d.\nIt took %.2f ms\n" , File.open(ARGV[0]){|f| f.inject(0){|a,l| a+l.split.length } } , (Time.now - start) * 1000 I won't call it elegant, that seems subjective to me, but I do appreciate brevity. On Wed, Aug 19, 2009 at 12:52 PM, Ben Christensen wrote: > pharrington, in your response you stated: > > "as the code that happens is neither the most "elegant" *nor* fastest > Ruby can do." > > Can you please provide me a re-write of the Ruby code I used that is > elegant and fast so I can learn from you? > > I consider myself quite advanced in Java (14 years of experience there) > but obviously do not have experience in Ruby for performance tuning and > optimization. > > I would appreciate your demonstration of how to perform the task I have > attempted in Ruby using an appropriate "Ruby" approach that achieves the > highest performance possible and the "elegance" spoke of. > > Thank you. > > Ben > > -- > Posted via http://www.ruby-forum.com/. > > --000e0cd25d822eb072047182a715--