On 05/17/2011 01:26 PM, Pirogov Eugene wrote: > I'm experience the loss of speed in NArrays. Did you guys tried benching > a simple access to an element in NArray? > > My benches show dramatical slowdown comparing to a Ruby built-in Array. > I already filled an issue here: > https://github.com/masa16/narray/issues/8. > It's too simple a benchmark to demonstrate the efficiency of narray. What it's measuring is access time from ruby. For the first two cases, the number in the ruby array is a fixnum (shifted by one bit and or-ed with 0x01) that can simply be returned with no modification, as a 32 or 64 bit VALUE (ruby's basic data type). In the third case, the number is stored as an 8 bit signed int, which has to be converted to VALUE by sign extending, shifting, and or-ing. As soon as you start measuring operations whose inputs and outputs are both NArrays (especially large ones), you'll see the speed...