This question has already been answered:

Advise a Java literature with code optimization tips or a resource. It is possible in English.

* I need literature with recommendations on how to write normal code, how to act in individual cases, which path to take, I understand all the advantages and disadvantages of java (so do not raise this question).

Reported as a duplicate by Nofate member ♦ Apr 17 '15 at 14:13 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • Java code and optimization is about the same as +30 heat in Moscow in December, if you want speed, write to C \ asm this is the best thing you can do. - igumnov
  • > Java code and optimization is about the same as +30 heat in Moscow in December, if you want speed, copy to С / asm this is the best thing you can do. time goes by and people do not change - they don’t understand how java works and they don’t try to figure it out. The assembly code is translated into instructions that the processor executes. Java code is translated into code that executes the JVM. Therefore, you can even say that java is a compiled script language. By smashing its speed, you smear JVM performance (written in C, by the way). ps I am silent about the fact that there is a platform dependent JIT compilation - jmu
  • @igumnov so you think that Java programs cannot be optimized? So you think that rewriting the same code only on c / asm will give a huge performance boost (I'm certainly not talking about game development, for example, this is a separate topic). As for the question, it all depends on what you write. It is useful to know the insides (how the classes that you use work) and the algorithms. - rasmisha
  • @jmu I have nothing against Java, this is a good development tool, but doing something on it that requires extremely high peak performance and a large memory consumption is a really bad idea. @rasmisha You can of course. But you need to understand well what, why, why and how it is optimized. If you rewrite the same code in C, then at least you can save the memory that is required to support the operation of the JVM. In general, Java performance = holivar. Therefore, I leave the thread. - igumnov
  • five
    2 @igumnov: better good java code than bad C / Asm. I think this is obvious to everyone. And I will also tell you what is obvious to any “customer” - it is better to write a product in java than in C / Asm. Cheaper, faster, and usually more qualitatively (because more qualified specialists are available) + easier to maintain. ps an adequate programmer will optimize even the code that no one needs. Even if it is a baht (walking) script, at home, for a one-time task. There is nothing wrong with that a person wants to develop and write code better while perfecting himself - jmu

4 answers 4

I can advise on the update Effective Java 2nd Edition by Joshua Bloch (ISBN-13: 860-1300201986, ISBN-10: 0321356683) , one of my favorite books

    I need literature with recommendations on how to write normal code.

    Here is a specific how to write optimal code: Java Code Optimization

      Java Puzzlers - Joshua Bloch. Now I read - very interesting