Performance Tips
l Optimizer can’t do everything – you can help
– Be aware of overhead in some library routines
l Use newer “collections” classes rather than older (Vector,
Hashtable) classes.
– Use profiler to test your program’s performance
– Don’t unnecessarily create objects
l Allocate temporary objects outside loop and reuse them
– StringBuffer is much more efficient than String for
string manipulation
– Use buffered IO routines for reading data
l BufferedReader, BufferedInputStream
l Use the java.nio package when it becomes available
– Be wary of lists like this one
l Many of them are outdated by newer Java VM’s
34