Learning improvement: SQL execution order writing optimization λ instead of for switch instead of if Shift operation instead of multiplication and division The difference between JSON JS and JAVA array

Personal study notes
Continuing from the technical summary of the previous blog, I realized that there is still a lot of room for improvement in my java programming ability, so I took advantage of the annual vacation to study and improve:

Novice programmers are full of screens with for loops and if judgments. The last time they wrote a time period, the judgment did not kill themselves. The
variable naming was not standardized. The method was not well extracted and the code was not considered to be optimized compared to the JVM, let alone open multithreading.

Shift operations instead of multiplication and division

j = j*2; replace with j = j<<1;
j = j/2; replace with j = j>>1;
…In other cases, the
calculation is more in line with the underlying logic of the computer, which is binary, The computational efficiency can be increased by four to five times.
Binary is not explained here. I feel like I can’t forget binary in my life. It’s too basic.

SQL writing optimization

The previous writing order of sql: select from where group by order by having
sql执行顺序: from where group by select having order by
sql new writing order: from where group by select

Then write SQL according to the execution order and develop a habit to improve accuracy and writing efficiency

switch instead of if

(1) When we need to use IF for multiple judgments, replacing IF with SWITCH allows us to write formulas more quickly and logically, without having to write judgment conditions repeatedly, it is easy to test later, and the probability of error is smaller.
(2) The address of the switch jump is set at the compilation stage, so the execution efficiency will be higher than if nesting. .

The difference between JS and JAVA array

1. Java arrays are strongly typed, js arrays are weakly typed JS arrays

2. js array has the advantages of java array and araaylist

JSON object syntax

JSON

λ instead of for

pending upgrade

Guess you like

Origin blog.csdn.net/Beatingworldline/article/details/113694224