News for hackers. Stuff that matters.
Re:Building a Cloud Database from Scratch: Why We Moved from... by kaba0 on Saturday May 28, 2022 @05:01AM (#31538778)
> The ability to jump between worlds

I feel like it is not possible from low level language, but contrary, it is possible from managed languages. It is easier to give a small escape hatch in a GCd language to allocate n bytes and manipulate it as if you were in C, then to add some hacky semi-GC to C/C++/Rust. Don’t get me wrong, unqiue pointers are really cool and useful, but shared pointers for example can’t be that painfully implemented without full control over execution (thinking of circular dependencies here).

Re:Building a Cloud Database from Scratch: Why We Moved from... by kllrnohj on Saturday May 28, 2022 @12:34PM (#31541648)
Managed languages almost never offer comparable escape hatches. Eg, it's not possible to do anything interesting at all with the JVM. Nor with JS. Nor with Python. Etc..

None of them let you do either placement allocations nor arena allocations.

.NET at least lets you do a linear array of structs, but that's nearly it.

Re:Building a Cloud Database from Scratch: Why We Moved from... by kaba0 on Saturday May 28, 2022 @12:46PM (#31541758)
JVM: bytebuffer, recently https://openjdk.java.net/jeps/393 for even more low-level access.

Python also has similar techniques available. .NET indeed leads the bunch though. But arbitrary pointer arithmetics is not necessary for arena allocation and safe usage.

Re:Building a Cloud Database from Scratch: Why We Moved from... by kllrnohj on Saturday May 28, 2022 @05:27PM (#31544038)
None of those let you allocate objects from those arenas. You can't deserialized into a ByteBuffer.

Hell, you can't even do linear object arrays in the JVM (still waiting on value types...), the most basic of memory optimization techniques.

Also for a JVM or Python, you can't avoid the extra overhead in an object (such as the ref count for python), which increases cache pressure and limits how much cache locality you can exploit.

Re:Building a Cloud Database from Scratch: Why We Moved from... by kaba0 on Sunday May 29, 2022 @03:05AM (#31547087)
Because objects in these languages don’t have a uniform representation, it is up to the implementation how a java object is layed out in memory for example. But an allocated memory region is just a.. memory region in java and in C++ as well - you can store your custom data structure in both.

Sure, value types will be a huge win, but it is not like you can’t store your RGB class’s data quite trivially into a huge linear structure as SOA or AOS as needed, and deserialize as needed.