Tips for improving the performane of Java applications

27 Oct 2008
Posted by loner
  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?

Hacking Asterisk and Rails with RAGI | Joe Heitzeberg at O'Reilly (7 years 19 weeks ago): ......I'll provide a quick overview of how Asterisk, the open source PBX, can be used as a general-purpose "telephony protocol server," and can be connected to Ruby on Rails to create a rapid prototyping environment for creating next-generation VoIP applications and services....... http://www.oreillynet.com/