Performance graphs for javolution.util package (Javolution Collections versus Standard Collections Classes) are shown in Annex of the presentation:

Collection Classes for Real-Time and High-Performance Applications (pdf)


The benchmark results below use the new Javolution TimeContext, it shows the average execution time followed by the minimum time in parenthesis.

The benchmark can be executed with the command:

java -server -Xms512M -Xmx512M -jar javolution.jar perf

or simply: ant run.

Windows XP - Intel Pentium Dual Core - 2.9 GHz - 512M of RAM:

C:\javolution-5.2>java -version
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

C:\javolution-5.2>ant run
      ...

run:
     [java] [info] Javolution - Java(TM) Solution for Real-Time and Embedded Systems
     [java] [info] Version 5.2.2 (J2SE 1.6+) September 3 2007 (http://javolution.org)
     [java] [info] 
     [java] [info] Load Configurable Parameters from System.getProperties()...
     [java] [info] 
     [java] [info] -------------------------------------------------
     [java] [info] -- Test Suite for package javolution.context.* --
     [java] [info] -------------------------------------------------
     [java] [test] ConcurrentContext - Quick Sort (size: 10000, concurrency: 0): 10.0 ms (minimum 7.82 ms)
     [java] [test] ConcurrentContext - Quick Sort (size: 10000, concurrency: 1): 5.26 ms (minimum 4.52 ms)
     [java] [info] 
     [java] [test] HeapContext (default) - Create 1000 small objects: 30.3 ns (minimum 23.4 ns)
     [java] [test] StackContext            Create 1000 small objects: 28.6 ns (minimum 25.7 ns)
     [java] [info] 
     [java] [test] HeapContext (default)            - new char[4096]: 6.95 us (minimum 4.46 us)
     [java] [test] Recycled - ArrayFactory.CHARS_FACTORY.array(4096): 2.01 us (minimum 1.67 us)
     [java] [info] 
     [java] [info] ----------------------------------------------
     [java] [info] -- Test Suite for javolution.util.* classes --
     [java] [info] ----------------------------------------------
     [java] [info] Collections/Maps of 256 elements (configurable "javolution.UtilTestSuite#SIZE")
     [java] [info] 
     [java] [info]  - Add elements to collection -
     [java] [test] New javolution.util.FastTable.add(element)                  : 39.7 ns (minimum 36.0 ns)
     [java] [test] New java.util.ArrayList.add(element)                        : 43.4 ns (minimum 38.1 ns)
     [java] [test] New javolution.util.FastList.add(element)                   : 53.2 ns (minimum 46.9 ns)
     [java] [test] New java.util.LinkedList.add(element)                       : 49.1 ns (minimum 46.9 ns)
     [java] [test] New javolution.util.FastSet.add(element)                    : 170 ns (minimum 153 ns)
     [java] [test] New java.util.HashSet.add(element)                          : 149 ns (minimum 138 ns)
     [java] [test] Recycled javolution.util.FastTable.add(element)             : 30.5 ns (minimum 28.3 ns)
     [java] [test] Recycled java.util.ArrayList.add(element)                   : 28.4 ns (minimum 27.2 ns)
     [java] [test] Recycled javolution.util.FastList.add(element)              : 38.6 ns (minimum 37.1 ns)
     [java] [test] Recycled java.util.LinkedList.add(element)                  : 50.7 ns (minimum 46.9 ns)
     [java] [test] Recycled javolution.util.FastSet.add(element)               : 124 ns (minimum 110 ns)
     [java] [test] Recycled java.util.HashSet.add(element)                     : 113 ns (minimum 109 ns)
     [java] [info] 
     [java] [info]  - Iterate over collections -
     [java] [test] Iterates over javolution.util.FastTable                     : 15.1 ns (minimum 13.0 ns)
     [java] [test] Iterates over java.util.ArrayList                           : 22.4 ns (minimum 20.7 ns)
     [java] [test] Iterates over javolution.util.FastList                      : 27.4 ns (minimum 25.0 ns)
     [java] [test] Iterates over java.util.LinkedList                          : 39.0 ns (minimum 36.0 ns)
     [java] [test] Iterates over javolution.util.FastSet                       : 35.2 ns (minimum 32.7 ns)
     [java] [test] Iterates over java.util.HashSet                             : 49.9 ns (minimum 46.9 ns)
     [java] [info] 
     [java] [info]  - Put new key/value pairs to map instance -
     [java] [test] New javolution.util.FastMap.put(key, value)                 : 135 ns (minimum 128 ns)
     [java] [test] New java.util.HashMap.put(key, value)                       : 132 ns (minimum 125 ns)
     [java] [test] New java.util.LinkedHashMap.put(key, value)                 : 158 ns (minimum 146 ns)
     [java] [test] New javolution.UtilTestSuite$SharedFastMap.put(key, value)  : 174 ns (minimum 164 ns)
     [java] [test] New java.util.concurrent.ConcurrentHashMap.put(key, value)  : 222 ns (minimum 204 ns)
     [java] [test] Recycled javolution.util.FastMap.put(key, value)            : 88.2 ns (minimum 82.9 ns)
     [java] [test] Recycled java.util.HashMap.put(key, value)                  : 98.3 ns (minimum 94.9 ns)
     [java] [test] Recycled java.util.LinkedHashMap.put(key, value)            : 130 ns (minimum 126 ns)
     [java] [info] 
     [java] [info]  - Retrieves map value from key - 
     [java] [test] javolution.util.FastMap.get(key):                           : 30.7 ns (minimum 28.3 ns)
     [java] [test] java.util.HashMap.get(key):                                 : 29.9 ns (minimum 28.3 ns)
     [java] [test] java.util.LinkedHashMap.get(key):                           : 74.9 ns (minimum 72.0 ns)
     [java] [test] javolution.UtilTestSuite$SharedFastMap.get(key):            : 74.2 ns (minimum 72.0 ns)
     [java] [test] java.util.concurrent.ConcurrentHashMap.get(key):            : 78.6 ns (minimum 75.2 ns)
     [java] [info] 
     [java] [info]  - Iterates over map entries - 
     [java] [test] Iterates over javolution.util.FastMap                       : 15.0 ns (minimum 13.0 ns)
     [java] [test] Iterates over java.util.HashMap                             : 32.7 ns (minimum 30.5 ns)
     [java] [test] Iterates over java.util.LinkedHashMap                       : 30.9 ns (minimum 28.3 ns)
     [java] [test] Iterates over javolution.UtilTestSuite$SharedFastMap        : 35.2 ns (minimum 32.7 ns)
     [java] [test] Iterates over java.util.concurrent.ConcurrentHashMap        : 48.3 ns (minimum 43.6 ns)
     [java] [info] 
     [java] [info]  - Direct collection/map iterations (no iterator) - 
     [java] [test] javolution.util.FastTable.get(i)                            : 10.8 ns (minimum 8.72 ns)
     [java] [test] java.util.ArrayList.get(i)                                  : 8.95 ns (minimum 7.63 ns)
     [java] [test] javolution.util.FastList.Node.getNext()                     : 10.9 ns (minimum 9.82 ns)
     [java] [test] javolution.util.FastMap.Entry.getNext()                     : 10.9 ns (minimum 9.82 ns)
     [java] [info] 
     [java] [info] More tests coming soon...

FAQ:

  1. Although it looks nice, I see that some of your collection classes are not always faster than their Java 6 counterparts.

    Some classes are faster, others are slower (for example ArrayList.get(int) is faster with the -server option, slower without it).

    Overall, there is no significative difference in average execution time. The main advantage of Javolution collections is that they are time-deterministic (the maximum execution time is very close to the minimum execution time) and they are RTSJ-Safe.

    They have some additional characteristics such as thread-safe without synchronization, support for custom key/value comparators, direct record iterations (faster than iterators), recyclable, reduced impact on GC (fragmentation or large arrays allocations), support for custom entry implementation (FastMap) or custom node implementation (FastList), etc.