• Welcome to Valhalla Legends Archive.
 

Map implementation Performance Comparison

Started by Orillion, September 26, 2003, 10:17 PM

Previous topic - Next topic

Orillion

I'm doing some comparison's between various implementations of Java's map interface, mainly between a SortedArray Map and a Binary Search Tree Map and my timings have produced nothing very conclusive in terms of which proves a better implementation overall.

The tests I've run involve the creation of a banking system (eg creation of Accounts, deposits,. withdraws and closing of accounts). I've run the test on some large numbers (eg 10,000+ transactions).

Any suggestions on what implementation should have the best performance?

Grok

You should also consider comparison tests under different loads.  Not all clients will have equal numbers of processes, CPU availability, and memory constraints.  MSDN has Windows stress loading tools, and I'm sure *nix has them too, because *nix has everything.

Banana fanna fo fanna

HashMap should, in theory.

There's several other considerations though. For example, synchronization may be a factor (Collections.synchronizedMap(new HashMap()).

Also, to get an accurate benchmark, run your program a few times so it gets cached in RAM. Also, within each run, run it several hundred times, because if you're using Sun's VM, hotspot will do some JIT optimizing on the hashing/sorting/whatever algorithm. Finally, different Java implementations may implement it differently. GNU Classpath+gcj may be faster, but I don't know.

As always, you should be using jikes as your compiler for everything.

Orillion

Yes an OpenHashMap is definately the most efficent. And yes I do use jikes

MrRaza