From: brabuhr@... Date: 2009-08-21T01:27:05+09:00 Subject: Re: Confirm my Performance Test Against Java? On Thu, Aug 20, 2009 at 11:22 AM, Ben Christensen wrote: > -- My preference would be, if I can write 97% of the program in Ruby, > and > -- 3% in C, is that really going to be less pleasant than writing 100% > of the > -- program in Java? > > An interesting observation and one I must consider. Or, perhaps in your case: 9x% in Ruby, y% in Java. Example 1: require 'java' java_import 'FileReadParse' FileReadParse.new.do_stuff Example 2: require 'java' java_import 'java.util.StringTokenizer' File.open("/tmp/file_test.txt") do |file| file.each_line do |line| tokens = StringTokenizer.new(line) tokens.each do |token| #do_stuff_with(token) end end end (Though in the token counting case, example 2 is slower than pure ruby: "tokens = StringTokenizer.new(line)" takes more time than "tokens = line.split".) Example 3: require 'java' java_import 'TokenProcessor' token_processor = TokenProcessor.new File.open("/tmp/file_test.txt") do |file| file.each_line do |line| line.split.each do |token| token_processor.process(token) end end end There could also be room in your toolbox for Ruby to help in the testing of your Java code: http://jtestr.codehaus.org/ http://wiki.github.com/aslakhellesoy/cucumber/jruby-and-java