2009-05-17から1日間の記事一覧

Sparse HashのRubyバインディング

Sparse Hashに興味があったので、Rubyバインディングを作ってみた。http://storehouse.sakura.ne.jp/viewvc/viewvc.cgi/ruby-sparsehash/?root=svn #include "google/sparse_hash_map" #include "google/dense_hash_map" #include "sparsehash_internal.h" n…

Sparse HashのRubyバインディング: アクセス速度

一応、アクセス速度も測ってみる。 require 'sparsehash' require 'timeout' include Sparsehash [100, 10000, 1000000].each do |rnum| [Hash, DenseHashMap].each do |clazz| puts("#{clazz}: #{rnum}") hash = clazz.new (0...rnum).each do |i| buf = sp…

Sparse HashのRubyバインディング: charを使う

charを使えば少しは早くなるかもと思って、少し修正。 #include "google/sparse_hash_map" #include "google/dense_hash_map" #include "sparsehash_internal.h" #include <cstring> namespace { template <class T> struct Sparsehash { typename T *m; static void rb_sparse</class></cstring>…