<div dir="ltr">I'd never heard of this Chronicle Bytes library, I looked it up and the whole suite of OpenHFT tools look mighty nifty for high-performance Java.<div>Thanks for sharing!</div><div><br></div><div>About the repository, I've not gotten far enough along to put something up but I could put up a sandbox repo or something</div><div>If you want to mail me directly I'm more than happy to continue chatting. Had a look at your DB's source and saw some interesting approaches there.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 22, 2022 at 6:21 PM Johannes Lichtenberger <<a href="mailto:lichtenberger.johannes@gmail.com">lichtenberger.johannes@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">That's an interesting use case of the Foreign Memory API IMHO. I haven't even thought about using it in this particular case. I'm also working on a DBMS[1] side project in my spare time. I've used the Foreign Memory API to memory map the storage file (for reads), but couldn't measure much impact over a RandomAccess file / FileChannel reader. As it's an append-only store writes are done via the FileChannel abstraction instead.<div>The serialization/deserialization to an array of slots is done however using Chronicle Bytes with Bytes<ByteBuffer> mainly, as Chronicle handles the resizing and does some Unsafe tricks, IIRC.</div><div><br></div><div>@Gavin, do you also have a repository? I'd love to exchange ideas as I'm currently the only one working on the project and sharing thoughts/ideas would be awesome.<br></div><div><br></div><div>Kind regards</div><div>Johannes<br><div> </div><div>[1] <a href="https://github.com/sirixdb/sirix" target="_blank">https://github.com/sirixdb/sirix</a> and the query engine <a href="https://github.com/sirixdb/brackit" target="_blank">https://github.com/sirixdb/brackit</a></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Mo., 22. Aug. 2022 um 20:30 Uhr schrieb Gavin Ray <<a href="mailto:ray.gavin97@gmail.com" target="_blank">ray.gavin97@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thanks Paul,<div><br></div><div>The API is a fair bit wordier, but that's the price you pay in exchange for greater expressiveness and flexibility I suppose.</div><div>I'll likely go forward with the MemorySegment implementation then -- I appreciate the reply!</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 22, 2022 at 2:21 PM Paul Sandoz <<a href="mailto:paul.sandoz@oracle.com" target="_blank">paul.sandoz@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Gavin,<br>
<br>
This is the right place to reach out.<br>
<br>
Using MemorySegment will given you far more control over the description (layout) and management (freeing and pooling) than ByteBuffer. Also, if it’s an issue you will also not be constrained by ByteBuffer’s size limitation. Performance wise using MemorySegment should be as good as or better than ByteBuffer.<br>
<br>
In many respects MemorySegment is a better API to interact with native memory. ByteBuffer was introduced in Java 1.4 with NIO and had additional design constraints in mind that are less relevant today (such as an internal mutable index).<br>
<br>
Paul.<br>
<br>
> On Aug 20, 2022, at 10:35 AM, Gavin Ray <<a href="mailto:ray.gavin97@gmail.com" target="_blank">ray.gavin97@gmail.com</a>> wrote:<br>
> <br>
> Hiya, I hope it's okay that I ask questions here (if not, please direct me elsewhere)<br>
> <br>
> I tried to ask on StackOverflow without much luck, and there aren't many resources<br>
> available at the moment to read about the Foreign Memory API so I'm reaching out here.<br>
> <br>
> I'm implementing a basic database on the JVM and am trying to understand the<br>
> technical implications of using either ByteBuffer or MemorySegment for heap page management and in-memory buffer allocation.<br>
> <br>
> Details are in this thread:<br>
> database - Java: Performance of ByteBuffer versus jdk.incubator.foreign (Panama) Foreign Memory methods (MemoryLayout/Segment) - Stack Overflow<br>
> <br>
> Would appreciate any information folks would be willing to share =)<br>
> <br>
> Thank you,<br>
> Gavin Ray<br>
> <br>
> (By the way, I'm not subscribed to the mailing list, will I be able to reply to responses?)<br>
<br>
</blockquote></div>
</blockquote></div>
</blockquote></div>