Darrel Schneider created GEODE-9466:
---------------------------------------
Summary: ByteBufferInputStream slower on Java 9 and later
Key: GEODE-9466
URL: https://issues.apache.org/jira/browse/GEODE-9466
Project: Geode
Issue Type: Improvement
Components: core
Reporter: Darrel Schneider
ByteBufferInputStream has a method determineUnaligned that will always return
false on java 9 and later. This is because it calls Method.setAccessible which
is not allowed under normal conditions starting with java 9 (see:
[https://stackoverflow.com/questions/41265266/how-to-solve-inaccessibleobjectexception-unable-to-make-member-accessible-m).|https://stackoverflow.com/questions/41265266/how-to-solve-inaccessibleobjectexception-unable-to-make-member-accessible-m]
This causes ByteBufferInputStream to do a bunch of its work a byte at a time
instead of using the optimal multi-byte methods like readShort, readInt, and
readLong.
It would be simple to change determineUnaligned in its exception catch block to
read the "os.arch" system property and if it is any of the following to return
true:
arch.equals("i386") || arch.equals("x86")
|| arch.equals("amd64") || arch.equals("x86_64")
|| arch.equals("ppc64") || arch.equals("ppc64le")
This is what the Bits class does. It might be worth checking a more recent jdk
to see if the list of os.arch that support unaligned reads has grown.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)