AI News Feed
Market watch
Products & Applications

Developer Publishes ChaosTree, a Zero-Dependency Java Tree Library

A developer has released ChaosTree on Hacker News, a zero-dependency Java Sorted Set/Map library with AVL, red-black, B-tree and B+ tree implementations, and is seeking feedback on its API, implementation and benchmarks.

The library implements the standard NavigableSet, NavigableMap, SequencedSet and SequencedMap interfaces, the developer wrote. Its custom API includes buildFromSorted(Iterator> it, float factor), importFlatMatrix(Object[][] blast, float factor), and exportFlatMatrix().

The developer said the project began as an exploration of data structures. The first release covered seven tree types of Set with a custom API. As work continued, the project moved to Map implementations, a transition the developer described as a drastic change and knowledge upgrade. The project also moved from JDK 11+ support to JDK 21+, with close attention to dependency-free design, memory layout, allocation, JVM behavior and real-world performance.

Among the areas the developer experimented with were different node layouts and metadata footprints, CRTP or F-bounded polymorphism for tree implementations, parent-pointer versus parentless nodes, array-based N-ary tree nodes, B-Tree and B+Tree degree selection, JMH benchmarking and JFR profiling, and differential or randomized testing against java.util.TreeMap and java.util.TreeSet.

Testing included Guava Testlib compatibility testing, jqwik property-based testing, randomized differential testing against reference collections, white-box structural validation of tree nodes, direct validation of B-Tree and B+Tree structural invariants, exception and iterator-contract testing, serialization and cloning tests, and a custom jqwik test of API validation for the N-ary tree, according to the post.

The developer wrote that tail latency behavior is not shown on the main results page because it is truncated into simple text that makes the data read incorrectly, and linked to a separate JMH report. The developer also ran a benchmark using the official JDK TreeMapUpdate against the N-ary tree. The GitHub repository and project site are linked in the post.

The post had received 6 points and 4 comments at the time of writing. The developer said feedback is especially welcome on API design, implementation choices and benchmark methodology, and added that work is currently focused on truncating useless and complex branches for performance tuning.