Memory Segment efficient array handling
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Thu Apr 1 16:01:23 UTC 2021
On 01/04/2021 16:32, Uwe Schindler wrote:
> New code: Map the huge file into few MappedMemorySegments (not too large to prevent fragmentation issues). Each memory segment sliced using MemorySegment.asSlice(...).asByteBuffer(). Access speed should be identical to current code, just less mappings in kernel needed and we have safe unmapping.
Yeah - that should work. Note that, right now shared segments and
buffers have an issue when it comes to async IO. This issue will be
resolved now that we have the new ResourceScope API, but the code which
fixes this is not there yet. So depending on whether you use these or
not, you might see some issues.
That said, we should really look into where the performance issues come
from... I know there's a bunch of workarounds in place for the long vs.
int (which might go away soon), but historically these workarounds have
served us well; it would be interesting here to understand if the issues
you are seeing are "more of the same" or a new issue.
Maurizio
More information about the panama-dev
mailing list