Hi,

Using C, if a state can be represented as a number between 0 and 255, we
can use an array of (unsigned) char's.  With this, 100 millions of states
= 100 Mbytes of memory.  With Ruby array of integers, this is equal to 400
Mbytes of memory.  Because these days a workstation typically has 0.5 to 2
gigabytes of memory, using either Ruby or C can be a "make or
break" case, depending on exact number of the 100 millions. Also,
depending on the algorithm, the C execution may be 10 times faster.

Regards,

Bill
=========================================================================
Christian Szegedy <szegedy / nospam.or.uni-bonn.de> wrote:
> William Djaja Tjokroaminata wrote:
>> Hi,
>> 
>> I think if you really have 100s of millions of states to be searched,
>> probably you should consider to code it in straight C to conserve memory
>> and to speed up execution.

> If one uses Arrays of Integers in Ruby, then you would not spare much
> memory using C. Large arrays of Integers are quite efficient in Ruby.
> (You just loose one 1 bit precisin per integer, that's all).

> Best Regards, Christian