I’m interested in the feature of FDB’s enableDirectBufferQuery. Hopefully, it can reduce heap memory allocation, thus reduce GC overhead. So, I did an experiment on FDB-java-binding 6.3.23, and compared the result of w and w/o enableDirectBufferQuery. The result indicates there is no difference on the performance aspect. I use JVM async profiling tool to check the alloc event, and found the byte (from heap) memory allocation was moved from JNI to DirectBufferIterator, which explains why there is no perf improvement.
I also checked the main branch, and found there is also heap memory allocation in RangeResultDirectBufferIterator
Why the data copy is required? I guess that the reason may be the DirectBufferIterator’s lifecycle is different from RangeQuery. Is it possible to pass the DirectBuffer to RangeQuery and adding a close() method to RangeQuery? Then it reduces the memory allocation on heap and data copy.