uschindler commented on PR #12841: URL: https://github.com/apache/lucene/pull/12841#issuecomment-1843857763
The best idea that I have instead of VarHandles: Create an implementation for ByteBuffer (using the methods available there). This implementation would work with: - byte arrays: Use ByteBuffer.wrap(), do stuff. Don't care about the instances, with Java 11+ the escape anaylsis will nuke the bytebuffers - ByteBuffers - use as is - MemorySegment: You can wrap a MemorySegent slice as ByteBuffer (like byte arrays). The MemorySegment code wraps just the portion as a single use byteBuffer, calls the generic method and throws it away. Also here: the temporary object is nuked by escape analysis I would give that a try: It is easy and reuseable as we just use a ByteBuffer as a view on top of the small area. P.S.: That escape analysis works you can see in our Panama Vector Util. Every vector multiplication creates around 20 objects.... -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org