Jeremy Mason writes the following about Java performance:
* Don't forget to upgrade every so often. JDK6, for example, runs code compiled for JDK4 just fine, and you get a big performance boost. For free.
* Memory allocation is pretty cheap. Know that there are three garbage collectors, and know which one is best, when. Read the Java memory management white paper.
* Hotspot can do lots of things to optimize your locks, but it often doesn't. Having said that, the bottlenecks in concurrent code usually have to do with contention, not synchronization overhead. Use low contention data structures like ConcurrentHashMap to avoid contention, but don't try to get clever with locking.
* Contrary to popular belief, thread-per-request synchronous servers are often faster than selector-based asynchronous servers.
Read the rest of Jeremy's post and presentation slides: