ALL
20 bit operations programmers should know
While talking about bit operation, programmers usually think about its efficiency. In embedded programming and system core optimization, appropriate use of bit operations is always a fascinating. When finding a job, it will help you a lot if you use bit operations when writing codes. Mastering simple bit arithmetic skills is necessary.1. Get maximum int valueint getMaxInt(){ return (1 << 31) - 1;//2147483647, } Another way:int getMaxInt(){ &nbs...
28,081 6 TIPS BIT OPERATION
Tips for improving PHP efficiency
0. Using single quote to replace double quote to enclose string literal, this will be a bit faster. Because PHP engine will search variables in double quoted string.1. If a method in class can be declared as static, then make it static, this will be 4 times faster.2. $row["id"] is 7 times faster than $row[id]3. echo is faster than print, and you should use multiple parameters instead of string concatenation, i.e use comma(,) instead of dot(.) to concatenate string. For example echo $str1,$str24. Calculate the numer of loops before executing for loop, don;t calculate the number of loops in each...
15,169 0 PHP EFFICIENCY TIPS