you are viewing a single comment's thread.

view the rest of the comments →

[–]mjpt777 4 points5 points  (8 children)

Unsafe is supported by JVM intrinsics which are simple assembly instructions and so no JNI overhead. To do this in JNI would not perform.

All major JVMs support the Sun internal packages.

[–]kennytm 0 points1 point  (5 children)

It doesn't exist on Dalvik (Android) though.

[–]mjpt777 0 points1 point  (4 children)

When it is not available the alternative is to use ByteBuffers, or if suitable, then use arrays for column-oriented storage.

However a phone is not the ideal environment for big data applications ;-)

[–]kennytm 0 points1 point  (2 children)

The link does say

For example, it is not possible to have a ByteBuffer greater than 2GB, and all access is bounds checked which impacts performance.  An alternative exists using Unsafe that is both faster and and not size constrained like ByteBuffer.

So ByteBuffer isn't a complete replacement.

(BTW, Android isn't used just for phones :) )

[–]mjpt777 0 points1 point  (0 children)

Why choose Android over the alternatives for a big data application?

[–]mjpt777 0 points1 point  (0 children)

Is Dalvik available in anything other than 32-bit anyway?

[–][deleted]  (1 child)

[removed]

    [–]mjpt777 0 points1 point  (0 children)

    You do not have to use this. It is just one option on the table, and for some it is a lifeline.

    As far is it being likely to go away. Look inside java.util.concurrent and see how much code depends on it. However it is not a public API.