Menu

1.5 release

I have just released version 1.5 of the javimmutable-collections library. This version contains a major overhaul of the array list and hash map implementations. The primary goal of this release was to improve performance. With that in mind the old trie implementations were replaced with newer, simpler ones that offloaded most of the work onto the Bit32Array classes. Coupled with various optimizations in those classes this release has doubled the performance of the JImmutableHashMap class.

Major changes in this release are:

  • replacement of the array.trie package with a newer, faster array.trie32 package
  • conversion of the hash package to use the new Trie32HashTable class internally for better performance
  • addition of a new JImmutableArray interface for sparse arrays
  • conversion of the JImmutableInsertOrderMap to use the new JImmutableArray class internally for better performance
  • addition of a new getValueOr() method to Indexed and Mapped interfaces to allow clients to avoid the need to use a Holder object to improve performance in some common cases

The JImmutableArray interface provides a sparse array implementation. Sparse arrays are similar to maps using integers as keys but provide better performance than a hash map and allow iteration over the integer keys in signed-int order (negatives before positives). The JImmutables.array() method allows for creation of empty or pre-filled arrays. These arrays accept any 32-bit integers as keys. Unlike a list, a sparse array does not require that keys be contiguous.

According to the results of the hash.TimingComparison benchmark the 1.5 version of the JImmutableHashMap is approximately twice as fast as the 1.4 version on my mac. To put this in perspective the difference is around 40 milliseconds in a 250,000 operation run so it's not really noticeable in practice. However for large enough data sets it could make the difference between using a mutable collection or an immutable one. The JImmutableHashMap is significantly faster than java.util.TreeMap in 1.5 according to the benchmark whereas in 1.4 it was approximately the same speed.

The new release is available for download now as a zip file from sourceforge and has also been released to maven central.

Posted by Brian Burton 2014-03-02

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.