Java optimizations [closed]
There are a number of Java programming practices that I commonly see in use that can be optimized to provide significant speedups.
Example: For lot's of +
operations on String
s, use StringBuilder
instead.
What are some simple, useful optimizations one can make to potentially improve your program's performance by a significant amount?
EDIT: I'm not looking for trivial premature optimizations. This is not my intention in asking this question. Instead I would like to learn common constructs/mistakes that do constitute a significant performance hit.
- Spend at least an order of magnitude more time thinking hard about the most efficient algorithms and data structures for the problem as you do thinking about how to micro-optimize specific operators, control-flow constructs, etc.
- See (1)
精彩评论