Wiki

Clone wiki

sparsehash/Ruby / Home

sparsehash

Copyright (c) 2009 SUGAWARA Genki <sgwr_dts@yahoo.co.jp>

Description

Ruby bindings for Google Sparse Hash.

see Google Sparse Hash.

Install SparseHash

on Debian/Ubuntu:

apt-get install libsparsehash-dev

on OS X:

brew install google-sparsehash 

or

port install google-sparsehash

Install GEM

gem install sparsehash

Example

require 'sparsehash'

map = Sparsehash::SparseHashMap.new
map['foo'] = 'bar'
map['zoo'] = 'baz'

map.each do |k, v|
  puts "#{k}=#{v}"
end

set = Sparsehash::SparseHashSet.new
set << 'foo'
set << 'bar'

set.each do |v|
  puts v
end

 

Performance

Updated