タグ

関連タグで絞り込む (0)

  • 関連タグはありません

タグの絞り込みを解除

cとrubyに関するk1mのブックマーク (1)

  • netswitch! | RubyInlineがすごい

    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

    k1m
    k1m 2007/03/14
    Inline::C for Ruby
  • 1