Tips for improving the performane of Java applications
- Use Native Methods: The small amount of overheads caused by JNI is usually outweighed by the improved speed of the native function
- Use Buffering on I/O Operations:
BufferedInputStream,BufferedOutputStream,BufferedReader,BufferedWriterreduce the number of I/O operations to be performed. - Avoid Creating New Objects: Reuse objects as much as possible. The more objects, the more memory to create/store them.
- Use
StringBufferinstead of String Concatenations - Avoid
SynchronizedMethods and Blocks - Use
ArrayListandHashMapinstead ofVectorandHashtable:VectorandHashtableare heavily synchronized for thread safety, whileArrayListandHashMap(which provide similar functionality) are not. You can make theseCollectionclasses thread safe by calling static methods within theCollectionclass that create a thread-safe wrapper around a collection. - Use Resource Pooling for Threads, Databases and Network connections
- Make Methods
Final,Static,Private: These enable static binding, which is faster than dynamic binding. - 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/
