In my previous tests I wanted to see how fast I could get the creation of components. I decided to re-write a Generic Bean in Java and see if the speed changed at all. I had done this with a defined bean (a Person with a name and an age), but what about a Generic Bean?

I created the generic bean very quickly in Java, it hasnt got any logic in it, you create it and then put() and get() values or objects you have placed into this bean. There is no error checking, it could barf and do some crazy things so it's not production code, just for testing you understand.

The code for the test is as follows, its pretty similar to my previous tests so nothing should shock you here:

__MSP_CODE_BLOCK_1__

My CFFML based Generic bean is also pretty simple:

__MSP_CODE_BLOCK_2__

The Java one is again, pretty much the same as above, but in Java:

package uk.co.markdrew.java; import java.util.HashMap; public class GenericBean \{ private HashMap objectMap; public GenericBean() \{ super(); this.objectMap = new HashMap(); } public void put(String key, Object object)\{ this.objectMap.put(key, object); } public Object get(String key)\{ return this.objectMap.get(key); } }

So, what happened in this test? Well, from the chart you can see that Java won hands down!

Maybe something to think about if you are doing a lot of object instantiations?

Again, this is another Caveat emptor considering I might be wrong and delusional