some performance numbers (test code is here http://pastebin.com/f6ead5a8a). I simulated doing a ConcurrentHashMap lookup with ScopeKey used as the key. From a single thread, I performed 3161899 * 5 map look ups to see what the performance implications are of the ScopeKey modifications.
Test run 1, original (current) ScopeKey implementation:
6058ms
6118ms
6016ms
6047ms
5952ms
6061ms
Test run 2, ScopeKey is implemented using ConcurrentSkipListMap and using getOptimizedKey for both Map key insertion and Map lookup:
496ms
498ms
524ms
514ms
524ms
Test run 3, ScopeKey is implemented using ConcurrentSkipListMap but getOptimizedKey is not used:
1233ms
1553ms
979ms
937ms
2229ms
Test run 4, ScopeKey is implemented using ConcurrentSkipListMap and using getOptimizedKey for only Map key insertion. Map lookup is using ScopeKey (probably slower due to mixing different object types in equals())
3815ms
3225ms
3978ms
3914ms
3201ms
Test run 5, ScopeKey is implemented using ConcurrentSkipListMap and using getOptimizedKey for only Map lookup. Map key insertion is with ScopeKey (probably slower due to mixing different object types in equals())
2754ms
2994ms
2938ms
2851ms
2777ms
Just for comparison, I ran the same test with four threads (each thread does the same number of iterations, so workload is increased * 4).
Test run 1, original (current) ScopeKey implementation:
thread 1 - 22861ms
thread 2 - 22702ms
thread 3 - 23014ms
thread 4 - 23190ms
thread 1 - 20145ms
thread 2 - 20222ms
thread 3 - 19947ms
thread 4 - 19780ms
thread 1 - 19787ms
thread 2 - 19416ms
thread 3 - 19910ms
thread 4 - 19835ms
Test run 2, ScopeKey is implemented using ConcurrentSkipListMap and using getOptimizedKey for both Map key insertion and Map lookup:
thread 1 - 985ms
thread 2 - 1018ms
thread 3 - 923ms
thread 4 - 895ms
thread 1 - 1122ms
thread 2 - 797ms
thread 3 - 994ms
thread 4 - 1049ms
thread 1 - 1068ms
thread 2 - 998ms
thread 3 - 931ms
thread 4 - 979ms
thread 1 - 1022ms
thread 2 - 1017ms
thread 3 - 959ms
thread 4 - 893ms
Test run 3, ScopeKey is implemented using ConcurrentSkipListMap but getOptimizedKey is not used:
thread 1 - 2640ms
thread 2 - 3160ms
thread 3 - 3057ms
thread 4 - 2944ms
thread 1 - 3108ms
thread 2 - 2807ms
thread 3 - 3171ms
thread 4 - 2958ms
thread 1 - 3160ms
thread 2 - 3166ms
thread 3 - 3214ms
thread 4 - 3202ms
thread 1 - 2945ms
thread 2 - 2962ms
thread 3 - 2616ms
thread 4 - 2817ms
"smarlow@redhat.com" wrote:
We still need to discuss the use of Java 6 (will help us scale better and Java 5 is hitting end of life October 30, 2009).