Tips for improving the performane of Java applications

  1. Use Native Methods: The small amount of overheads caused by JNI is usually outweighed by the improved speed of the native function
  2. Use Buffering on I/O Operations: BufferedInputStream, BufferedOutputStream, BufferedReader, BufferedWriter reduce the number of I/O operations to be performed.
  3. Avoid Creating New Objects: Reuse objects as much as possible. The more objects, the more memory to create/store them.
  4. Use StringBuffer instead of String Concatenations
  5. Avoid Synchronized Methods and Blocks
  6. Use ArrayList and HashMap instead of Vector and Hashtable: Vector and Hashtable are heavily synchronized for thread safety, while ArrayList and HashMap (which provide similar functionality) are not. You can make these Collection classes thread safe by calling static methods within the Collection class that create a thread-safe wrapper around a collection.
  7. Use Resource Pooling for Threads, Databases and Network connections
  8. Make Methods Final, Static, Private: These enable static binding, which is faster than dynamic binding.
  9. Minimise Subclasses and Method Overriding

What did I say then?

Patriot games just the beginning of Beijing hard ball (7 years 51 weeks ago):

The writing is on the wall. Forget about the official rhetoric - the depth of discontent within t...

Theme provided by Danang Probo Sayekti.