Branch: refs/heads/master Home: https://github.com/MacRuby/MacRuby Commit: 6beac71eb495bb0592954a5cdd81906347cdfe12 https://github.com/MacRuby/MacRuby/commit/6beac71eb495bb0592954a5cdd81906347... Author: Watson <watson1978@gmail.com> Date: 2012-12-29 (Sat, 29 Dec 2012) Changed paths: M string.c Log Message: ----------- improve a performance in String#== and String#eql? When the length of the string does not match, it will not need to invoke a memcmp(). * before user system total real == 0.230000 0.000000 0.230000 ( 0.233827) eql? 0.230000 0.000000 0.230000 ( 0.227859) * after user system total real == 0.020000 0.000000 0.020000 ( 0.014583) eql? 0.010000 0.000000 0.010000 ( 0.015350) Test Code: ---- require 'benchmark' str = "abc" * 100 str1 = str * 100 str2 = str * 200 Benchmark.bm(4) do |x| x.report "==" do 100000.times do str1 == str2 end end x.report "eql?" do 100000.times do str1.eql? str2 end end end