开发者

Book about writing optimized and performing code in Java [closed]

As it currently stands, this question is not a good fit for our 开发者_StackOverflow社区Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

Please can you suggest me a good book about writing performing and optimized code in Java? A book that moves from something of "basic" like e.g. "is more performing a static or local variable?" to something more complex.

If it exists of course :)

Thank you very much, Julio


Please can you suggest me a good book about writing performing and optimized code in Java?

Go for Effective Java - Joshua Bloch.

Copying some of the outstanding comments on this book,

  1. If every Java developer read this book, there would be a lot less broken code in the world.

  2. "I sure wish I had had this book ten years ago. Some might think that I don't need any Java books, but I need this one." -- James Gosling, Fellow and Vice President, Sun Microsystems, Inc.


This highly depends on your needs since there are many approaches to optimizing code. I'd say that optimizing on a language level isn't worth the trouble - you should most probably start learning data structures and algorithm since there you can do most optimisations, and those things are mostly language independent.

Don't bother whether static or local variables yield better performance, since that also depends on the definition of "performance".

Is it:

  • runtime performance?
  • delevopper performance aka productivity?
  • maintainance performance?
  • ...

I'd say runtime performance difference on such a low level is quite low and what matters more here are things like readability, maintainability and robustness.

Here's a suggestion for a book, however: Practical Java.
And another one: Effective Java


I really find Effective Java by Joshua Bloch to be terrific.


1) I would suggest you use a profiler. VisualVM is free and a good start.

2) I would suggest you use a code analysis tool. e.g. PMD or IntelliJ CE

3) Perhaps buy a book.

If you want to read on how you can improve perform you could read my blog which has at least 40 articles on improving Java performance. There are many others.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜