org.ObjectLayout

A layout-optimized Java data structure package

View the Project on GitHub ObjectLayout/ObjectLayout

View the Project JavaDoc ObjectLayout.github.com/ObjectLayout/JavaDoc

org.ObjectLayout: A layout-optimized Java data structure package

The org.ObjectLayout package provides a set of data structure classes designed with optimised memory layout in mind. These classes are aimed at matching the natural speed benefits similar data structure constructs enable in most C-style languages, while maintaining an idiomatic Java feel and a natural fit with existing code and libraries.

The package classes provide full functionality on all JVMs (of Java SE 7 or above) at reasonable layouts and execution speeds. However, the classes are carefully designed with semantics that would allow an optimised JVM to implement them with improved memory layout not directly expressible in Java.

The common C-style constructs org.ObjectLayout seeks to match are:

These common C-style constructs, both individually and in composed forms, provide tangible access speed benefits. The natural memory-layouts involved facilitate both dead-reckoning (avoiding de-referencing and data-dependent loads) and memory streaming optimizations.

The matching org.ObjectLayout forms

StructuredArray is meant to provide an idiomatic Java collection form with speed (and semantics) similar to an "array of structs" form, supporting any constructable java Object as an array member.

@Intrinsic provides an idiomatic Java means for declaring member objects that are intrinsic to the instances of the class they are declared in. @Intrinsic provides a "struct in struct" equivalent relationship between Java objects, exposing the speed and layout benefits similar to the same form in the C family languages.

Sub-classable Primitive and Reference array classes (e.g. PrimitiveLongArray and ReferenceArray ) are meant to support an idiomatic Java means of declaring constructs with speed (and semantics) similar to "struct with array at the end". They do so by supporting the subclassing of arrays of the various primitive and reference forms possible in Java. StructuredArray similarly supports this capability (via subclassing) for the equivalent of "struct with array of structs at the end".

Authors, Contributors, and License

ObjectLayout was authored by Gil Tene (@giltene) and Martin Thompson (@mjpt777) and placed in the public domain, as explained at http://creativecommons.org/publicdomain/zero/1.0/

Support or Contact

Don't call us, We won't call you.