You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/12/18 09:01:38 UTC

[GitHub] [shardingsphere] liuchaoheliang opened a new issue #8686: Why does the analysis take more time for the first time?

liuchaoheliang opened a new issue #8686:
URL: https://github.com/apache/shardingsphere/issues/8686


   version 5.x
   when I was testing and parsing a large sql,  use the same engine , new SQLStatementParserEngine("MySQL"), do 50 times parse. watch the cost time,
   i found The first few times are much more time-consuming than the subsequent analysis.  why ? 
    my java code like this:
       @Test
       public void test() {
           String sql = "select ........";
           SQLStatementParserEngine engine = new SQLStatementParserEngine("MySQL");
           int i = 0;
           while (i < 50){
               Long now = System.currentTimeMillis();
               engine.parse(sql, false);
               Long cost = System.currentTimeMillis() - now;
               System.out.println("cost:" + cost);
               i++;
           }
       }
   
   RESULT:
   times: 0,cost(ms):1097
   times: 1,cost(ms):11
   times: 2,cost(ms):13
   times: 3,cost(ms):8
   times: 4,cost(ms):9
   times: 5,cost(ms):4
   times: 6,cost(ms):3
   times: 7,cost(ms):3
   times: 8,cost(ms):3
   times: 9,cost(ms):4
   times: 10,cost(ms):9
   times: 11,cost(ms):4
   times: 12,cost(ms):3
   times: 13,cost(ms):2
   times: 14,cost(ms):2
   times: 15,cost(ms):5
   times: 16,cost(ms):3
   times: 17,cost(ms):3
   times: 18,cost(ms):2
   times: 19,cost(ms):1
   times: 20,cost(ms):3
   .......
   
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] jingshanglu commented on issue #8686: Why does the analysis take more time for the first time?

Posted by GitBox <gi...@apache.org>.
jingshanglu commented on issue #8686:
URL: https://github.com/apache/shardingsphere/issues/8686#issuecomment-774616106


   > i know the cache, but when i test it ,i use “engine.parse(sql, false);” ,this means parser engine des't use cache. right ?
   
   Yes.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] Beyondeclipse commented on issue #8686: Why does the analysis take more time for the first time?

Posted by GitBox <gi...@apache.org>.
Beyondeclipse commented on issue #8686:
URL: https://github.com/apache/shardingsphere/issues/8686#issuecomment-865876845


   @liuchaoheliang Parser engine need to create/load many objects in the first time, and it takes time.


-- 
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:
users@infra.apache.org



[GitHub] [shardingsphere] liuchaoheliang commented on issue #8686: Why does the analysis take more time for the first time?

Posted by GitBox <gi...@apache.org>.
liuchaoheliang commented on issue #8686:
URL: https://github.com/apache/shardingsphere/issues/8686#issuecomment-751590341


   i know the cache, but when i test it ,i use “engine.parse(sql, false);” ,this means parser engine des't use cache. right ?


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang commented on issue #8686: Why does the analysis take more time for the first time?

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on issue #8686:
URL: https://github.com/apache/shardingsphere/issues/8686#issuecomment-927533934


   Since this issue has been inactive for more than 30 days, we will close it. 
   If you still have related questions, please submit a new issue, thank you.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] yu199195 commented on issue #8686: Why does the analysis take more time for the first time?

Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #8686:
URL: https://github.com/apache/shardingsphere/issues/8686#issuecomment-748885527


   @jingshanglu  Can you answer that?


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] jingshanglu commented on issue #8686: Why does the analysis take more time for the first time?

Posted by GitBox <gi...@apache.org>.
jingshanglu commented on issue #8686:
URL: https://github.com/apache/shardingsphere/issues/8686#issuecomment-751229885


   @liuchaoheliang @yu199195 Parser engine has a cache, only the first time it is parsed, and from the second time it gets the result from the cache.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang closed issue #8686: Why does the analysis take more time for the first time?

Posted by GitBox <gi...@apache.org>.
RaigorJiang closed issue #8686:
URL: https://github.com/apache/shardingsphere/issues/8686


   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org