Geek URL - this 35 Java code optimization details, you use it?

Benxi "Geeks Website" ██╇σσ: 688 [47] █ tsu

Foreword

  Code optimization, a very important issue. Some people may feel useless, some small places there is nothing to modify, change and do not change what impact the efficiency of the code? The question is what I consider, like the sea inside the whale, it eats a Shrimps helpful? useless, however, after more than one Shrimps eat whale was fed up.

  Code optimization is the same, if not the BUG project focusing on line as soon as possible, then the time may encounter, details of the code can not and deliberate; but if there is sufficient time to develop and maintain the code, this time it is necessary to consider each you can optimize the details, and one by one small optimization points accumulated for the efficiency of the code is absolutely upgrade.

  Code optimization objectives are:

  Code size reduction

  Improve the efficiency of code running

  Code optimization details

  1, designated as far as possible class, fi67085107360 Method)]

  8. Do not try to use in the loop ... catch ..., you should put it on the outermost

  Unless a last resort. If for no reason so written, as long as you a little senior leadership, there is a little obsessive-compulsive disorder, most probably you will curse Why write this code to the garbage.

  9, if the content length is estimated to be added to the bottom set of an array manner, the tools specify the initial length

  Such as ArrayList, Li000 character size of the array, saving more than doubled space;

  (2) the original character 4096 copied to the new character to the array.

  In this way, a waste of memory space and reduce the efficiency of the code. So, to the underlying array in order to achieve the set of tools to set a reasonable initial capacity is not wrong, it will bring immediate results. However, note that this array as HashMap to achieve the set list is +, do you estimate the initial size and the size of the set, like, just because the possibility of a connection object on a table is almost zero. Recommended to set the initial size, the use of buffered input and output streams of IO operations 2

  Buffered input and output streams, i.e. BufferedReader, BufferedWriter, BufferedI678901234 represented in the computer should be:

  0000 0000 0000 0000 0000 1011 0011 1010 0111 0011 1100 1110 0010 1111 1111 0010

  A i30, so the content is output on the console above us. In this example also the way to two conclusions:

  1, integer data type is the default if "

  2, then write a "i206.html

https://www.c242.html

https://www.cnblogs.com/pengxians/p/12435250.html

https://www.cnblogs.com/pengxians/p/12435260.html

https://www.cnblogs.com/pengxians/p/12435268.html

https://www.cnblogs.com/pengxians/p/12435282.html

Guess you like

Origin www.cnblogs.com/pengxians/p/12435291.html