ByteBuffer has always been significantly slower, in my experience, if you are not reading/writing in large chunks (e.g. any reading of singular values like ints/longs versus copying out or in large byte ranges).
The JVM can optimize loops over byte[] much more easily, the ByteBuffer abstraction gets in the way -- firstly by having at least two implementations in memory it introduces virtual dispatch that is usually optimized away but not always, and its harder for the JVM to see through the interface to elide redundant bounds-checks and similar. A ByteBuffer can match a byte array if you use certain sun.misc.Unsafe access methods, maybe the Java 9+ VarHandle stuff can also match it, but I have not tried. [ Full content available at: https://github.com/apache/parquet-mr/pull/505 ] This message was relayed via gitbox.apache.org for [email protected]
