yanyzy commented on issue #3034: Optimize performance, reduce unnecessary loops
URL: 
https://github.com/apache/incubator-shardingsphere/pull/3034#issuecomment-531631589
 
 
   @tuohai666 I tested it locally using the following code
   
   ```java
   @Test
       public void valueOfBenchmark() {
           int[] commands = new int[100_0000];
           for (int i = 0; i < 100_0000; i++) {
               commands[i] = random.nextInt(31);
           }
   
           Stopwatch stopwatch = Stopwatch.createStarted();
           for (int i = 0; i < 100_0000; i++) {
               MySQLCommandPacketType.valueOf(commands[i]);
           }
           System.out.println("1st Time of execution in MILLISECONDS:" + 
stopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
   
           stopwatch = Stopwatch.createStarted();
           for (int i = 0; i < 100_0000; i++) {
               MySQLCommandPacketType.valueOfOrigin(commands[i]);
           }
           System.out.println("2st Time of execution in MILLISECONDS:" + 
stopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
       }
   ```
   and the result of the operation is:
   1st Time of execution in MILLISECONDS:12
   2st Time of execution in MILLISECONDS:50

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to