Performance -------------------------------- rules ------------------------------------------ log rules for Debug, before output of Info-level logs, you must first judge the current debugging level. This indicates that logs generally have many strings for processing. if it is not Debug-level, there is no need to process the example if (logger. debugEnable () {logger. debug ("request:" + request. getMethod ();} the rule indicates that the logger object in the log tool class should be declared as static to prevent repeated new logger objects. logger indicates that various log tool classes can be log4j, common log, jdk logger, although some logger has some optimizations to the LogFactory, we must also prevent the code from running the array rule array replication to use the System. arraycopy (*) indicates better performance set rules. Do not convert the set into an Array Using loops. You can use toArray () of the Set () method Description: better performance code more concise String rules: adding a large number of strings should use StringBuffer to describe that a large number of strings are added equal to processing performance consumption. "A large number" is generally more than 5 times "+ = ". or in the loop string + = operation http://www.52mvc.com -------------------------------- recommended --------------------------------------- other API functions are recommended to use JDK built-in API functions, do not write similar function descriptions by yourself: JDK's own functions provide better performance in terms of reliability and performance, in particular, for algorithm I/O, it is recommended that I/O operation streams use classes with Buffer functions to demonstrate better performance. No Buffer output streams are frequently used for I/O operations. However, low I/O operation efficiency is recommended for public-type underlying functions. when determining invalid parameters, the system should take the initiative to throw a RuntimeException, indicating that the underlying function must ensure the correctness of the input parameters and then perform other processing to prevent subsequent code from throwing errors. Unnecessary subsequent code execution uses RuntimeException to reduce try. catch is everywhere and helps to quickly locate the Exception Code example www.2cto. compublic void doDivide (int a, int B) {if (B = 0) {throw new IllegalArgumentException ("denominator can't be zero ");}...}