larray icon indicating copy to clipboard operation
larray copied to clipboard

Add Int-index API for LArray.

Open xerial opened this issue 11 years ago • 3 comments

Long-based indexes has some performance overhead if no need exists to use buffers more than 2GB. We should provide LArray interface for int-based indexes.

The naming of this interface would be SArray or IArray.

xerial avatar Dec 01 '13 11:12 xerial

LBuffer introduced apply(i:Int), update(i:Int, v:A) methods. LIntArray etc. also needs to have these methods.

xerial avatar Dec 16 '13 08:12 xerial

I've tested both API on a 64-bit computer with Windows and I don't see any conclusive difference. All the int pointers will be expanded to 64bits anyway, and memory has some alignment limitations as well - I'd there is pretty much no benefit of having int indexing here

kosiakk avatar Jun 04 '18 15:06 kosiakk

@kosiakk Thanks for the update. My result was pretty old, so recent JVM might have some optimization around that.

xerial avatar Jun 04 '18 16:06 xerial