scalableminds / webknossos-wrap

Efficient 3D volume storage format for webKnossos and analyses
MIT License
8 stars 3 forks source link

Scala: make compatible with newer JREs #67

Closed fm3 closed 3 years ago

fm3 commented 3 years ago

Removes unsafe access to private methods of MappedByteBuffer and RandomAccessFile

Using the get(int) method in a for loop is potentially slower than the (private) memory copy that we accessed previously. However, I took some performance measurements in my local wK on a SSD (admittedly not really representative, and very noisy). I could’t detect a systematic change, both the old and the new code loaded buckets to the browser at about 30MBit/s.

Java 13 introduces a new bulk get for MappedByteBuffers, which would have been ideal, but if we want compatibility for older Java versions we can’t use that (or have to have multiple builds, which seems nontrivial) https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/nio/ByteBuffer.html#get(int,byte%5B%5D,int,int)

fm3 commented 3 years ago

@youri-k Thanks for having a look! I agree that the signature is better with int (in fact it was already called with int only). Could you have another look?