Posted by nanki Mon, 12 Mar 2007 05:14:00 GMT Rubyã³ã¼ãä¸ã«Cã®ã³ã¼ããåãè¾¼ããRubyInlineã使ã£ã¦ã ããã«ããã¯ã¨ãªã£ã¦ããã¡ã½ãããç½®ãæããã # rubyinline.rb def benchmark s = "a" * 10000 test = Test.new t = Time.now 1000.times{test.string_xor(s, s)} Time.now - t end class Test def string_xor(str1, str2) result = str1.clone str1.length.times do |i| result[i] ^= str2[i] end result end end b1 = benchmark begin require 'inline' class T
{{#tags}}- {{label}}
{{/tags}}