**BUSTED** How to speed up a byte[] lookup to be faster using sun.misc.Unsafe?

后端 未结 3 1230
醉话见心
醉话见心 2021-01-12 04:43

I am experimenting with Unsafe to iterate over memory instead of iterating over the values in a byte[]. A memory block is allocated using unsafe. The memory is sufficient to

3条回答
  •  情书的邮戳
    2021-01-12 05:22

    Unsafe methods may be marked as native but that does not mean they are necessarily JNI. Almost all the Unsafe methods are intrinsics (see a short post here: http://psy-lob-saw.blogspot.co.uk/2012/10/java-intrinsics-are-not-jni-calls.html) for the Sun JVM they will be converted to a single assembly instruction(in many cases), for other JVMs they may or may not be as good at dealing with intrinsics and may convert them to JNI calls or plain java calls. From what I know JRockit is tends to go the JNI way, so does the Android JVM.

提交回复
热议问题