On Wed, Apr 27, 2011 at 2:08 PM, Robert Klemme
<shortcutter / googlemail.com> wrote:
> On Wed, Apr 27, 2011 at 12:46 PM, Ville Sipola <ville_sipola / hotmail.com>=
 wrote:

>> Would you know an efficient way of moving a large data from C array to
>> ruby array?
>
> What about leaving it in C, i.e. wrapping in a specific type which
> presents an Array (or Enumerable) like API and uses your C array
> internally? =A0A similar approach is taken by ENV (you can find the code
> in hash.c).

PS: Of course whether that is more or less efficient than your
approach totally depends on the usage pattern.  If only few items in
those arrays are accessed from Ruby land the wrapping approach is
likely cheaper.  If all items are accessed in the majority of cases
then probably your original approach is better.

I'd also look into NArray which might help you here.

Kind regards

robert

--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/