ArrayList vs Vector

I’ve done some more work on the ArrayList vs Vector performance issue.  The post below originally stated that Vector would/could outperform ArrayList even though it is synchronized while ArrayList is not.  Well, in digging deeper into the issue, I”ve determined that there is a problem with the benchmarking framework being used.  I ran a very [...]

More on Autoboxing

I recently did a benchmark on Autoboxing where I determined that Autoboxing cost about 15 nanoseconds. Well, then I got to thinking that I’d written that test to work with int/Integer datatypes. But what about the other types? Today I add Boolean, Float, Double and Long into the mix. To cut to the chase, I’ll [...]

The cost of Autoboxing

Simple question: How expensive is autoboxing of int/Integer types? Simple answer: 15 nanoseconds per boxing. No autoboxing ( ints only ) [source:java] public void runInternalTrial() throws Exception { int i = getRandomWithoutAutobox(); } public int getRandomWithoutAutobox() { return rnd.nextInt(1000); } [/source] Autoboxing [source:java] public void runInternalTrial() throws Exception { int i = getRandom(); } // [...]

JVM Comparison and Java Optimization Myths

Here’s a fairly comprehensive overview of 6 performance related myths as they relate to 7 different JVMs.  I now feel safer running with try/catch blocks and with synchronization.  We’ll be running our own benchmarks on these and the results will be up pretty soon.  Here’s the link to the paper.

Building a unique collection of strings

I recently encountered some Java code that was building a unique list of String objects in order to prevent multiple processing of any of them. The code was using an ArrayList and would make a call to contains() to determine whether or not to add each String. I knew this wasn’t the optimal way of [...]

Connection Pool Showdown

I put C3P0, DBCP, and Proxool to the test and confirmed that DBCP is the fastest pool in the West, so long as there isn’t any complicated synchronization being done by the code using DBCP! C3P0, safe even with complicated synchronization and very, very configurable and robutst, came in a pretty close second. Proxool, the [...]

Log4J Conversion Pattern Performance

I’ve seen the warnings before in log4j’s documentation about the format directives %C, %F, %L, %l and %M, which give really useful information, but at a cost. Well, what is the cost of using some of these settings? What if I use them all, or none? I just had to find out, here are the [...]

Freemarker vs Raw Java

I’ve recently been pitting Freemarker against Raw Java of late because I was under the impression that Freemarker would blow up under load in a multi-threaded environment. Well, it turns out that things aren’t nearly as bad as I’d thought, but it’s still significantly slower than what I’ve been calling “Raw Java”. Here’s the final [...]

MultiThreaded Freemarker Benchmarks

I recently blogged about Freemarker performing 10-20x slower than pure Java analogues. I got to thinking about our webapp and the fact that I wasn’t quite testing the correct scenario. In a web environment there might be numerous threads all running Freemarker templates simultaneously. So, I had to put the pure Java analogues up against [...]

Freemarker Benchmarks

All of us at iCentris have currently embarked upon a torrid love affair with Freemarker templates. I admit that I, too, have been very excited about having them around. A freemarker template has quickly become the knee-jerk, defacto response to generating output – which is great for readability and maintainability. But lately, after repeated profiling [...]