views:

151

answers:

1

I simply need to add floatArray1 to floatArray2 storing the result in floatArray2.. no third array.. all arrays are one dimensional but are very large... probibly as large as the os will let me get away with. Max i would need is two float arrays with 40,000 floats each... but i could get away with 1/10th that i suppose minimum.

Would love to do this in 1/30th or 1/60th of a second but that does not seem possible? Also if the code is JNI,NDK or OpenGL ES thats fine.. does android have an assembly language or like machine code i could use somehow?

+1  A: 

Since a float is worth 32 bit and you have 40000 floats in each array you would need:

40000 * 32 * 2 = 2.560.000 bit

Which is 320.000 Byte. Not to much memory wise i would say since the default limit for an android app is 16MB.

Regarding performance you would definitely gain some speed using JNI. OpenGL would not give you enough benefit i would think since the OpenGL context creation takes some time as well.

Soulreaper
Thanks, i was worried the limit was smaller. I actually am creating a game, and there are many projectiles. So i already have the openglsurfaceview/renderer setup if that helps? Also could you just point me to a good jni with android tutorial?
nathan
you should check out the ndk documentation and the samples contained in the ndk: http://developer.android.com/sdk/ndk/index.html
Soulreaper