Guess I'm a johnny come lately to this discussion, but I have some interesting retorts to some of the performace topics that were discussed on this thread.
Basically, I have an XML parser I've been trying to squeeze a couple milliseconds out of; so I've rolled my own stack and hashmap data structures. Both grow by powers of 2.
The results I obtained were using a P4 @ 1.8GHz, J2SE 1.4.1, and J2EE 1.4.2.
As suggested by Josh Bloch here
I built my testing framework to run n timed runs, and take an average of all the runs. Also, I'm running the JVM with the -Xnoclassgc option. Also, I wrote 2 init functions, one to build a sequential list, and one to build a random list. Accessing with a single thread, the synchronized keyword did not affect my performace.Sequentially numbered keys are faster in all cases.HashMap suffers a penalty of approximately 5% on random lists.Hashtable suffers nearly a 40% penatly.HashMap is approximately 5% faster than Hashtable on random lists.Hashtable is about 35% faster than HashMap on sequential lists.In all cases MY implemention was faster
32768 items, 30 runs, put(), remove():
If anyone's still interested, I could post the testing framework.
[ December 19, 2003: Message edited by: Shawn Curry ]