From: George Dupre Date: 2012-05-23T19:22:28+09:00 Subject: Memory-efficient set of Fixnums Hi, I have to: 1) generate a database of a couple dozens of millions of Fixnums (ranging from 0 to 2^32 - 1), while avoiding redundancy 2) iterate through them 3) quickly search for the presence of a given Fixnum in the database The Set class fulfills the speed conditions and conveniently handles redundancy itself, but its uses up too much memory. It looks like each entry uses up around a 100 bytes, even if I only put 4 bytes in there. Array#include? is too slow without solving the memory problem. Representing each Fixnum as 4 bytes in a huge String doesn't use up much memory at all and String#include? is fast enough, but I can't tell it to only search by 4 bytes increments. Could someone help me with a solution for this problem? Thank you in advance. -- Posted via http://www.ruby-forum.com/.