Originally posted by Ram Krish:
(bare minimum)...
Don't write slow code.
There's much more to performance than a couple of tips. Software is vastly too complex for that. This is why we have the
First Rule of Optimization. By trying to optimize your code before you have established where a bottleneck is you are probably:
1. Focusing on non-critical parts of code (for example, writing a custom XML parser when the time it takes to parse a file is trivial compared to the amount of time it takes to read the file from a network drive)
2. Introducing bugs and maintaince headaches (Java already has numerous XML parsers which have been tested and debugged. Why reinvent the wheel?)
3. Wasting time and effort on "optimized" code when optimization isn't necessary (this XML parser gets run once a month by a cron job. who cares how fast it is? using your time efficiently is an optimization as well)
Now this does not excuse you from knowing how to use the Java language effectively. Check out the online book
Java Platform Performance Strategies. Not only does cover effective use of Java but it also covers how to measure performance and use benchmarks to compare solutions.