Memory Mapped file segment (file is empty)

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Jun 25 15:11:58 UTC 2020


To be clear - I'm referring to this:

https://github.com/sirixdb/sirix/blob/7bdbd5d17a034f02902f8f7dd0ef7012d89c81fb/bundles/sirix-core/src/main/java/org/sirix/io/memorymapped/MemoryMappedFileWriter.java#L160

This code is inefficient for a number of reasons:

* the var handle is not cached into a static final field (so the VM 
doesn't know it's constant)
* the base address keeps changing (see use of addOffset)

I think these issues can be addressed w/o changing anything other than 
the implementation?

Maurizio

On 25/06/2020 16:10, Maurizio Cimadamore wrote:
>
> On 25/06/2020 16:01, Johannes Lichtenberger wrote:
>> Regarding your comment about the loop, I'd have to change the 
>> interfaces, which use DataOutput / DataInput and swap the 
>> implementation I guess. That might be a bigger change. Isn't it 
>> possible to read/write a byte-array from the memory mapped file 
>> segment and afterwards deconstruct this byte-array via classes, which 
>> implement the DataOutput / DataInput interfaces? Maybe it's a stupid 
>> idea and way too inefficient -- so I'll just have to refactor this 
>> class for instance (and some others which are way too big):
>
> Not sure I follow- my comment about the loop was just a suggestion on 
> how to write in order to take advantage of all the JIT optimizations 
> available to eliminate the checks. I think my suggestions were rather 
> orthogonal to DataInput/Output?
>
> Maurizio
>


More information about the panama-dev mailing list