zabetak commented on a change in pull request #950: [CALCITE-2703] Reduce code 
generation and class loading overhead when executing queries in the 
EnumerableConvention (Stamatis Zampetakis)
URL: https://github.com/apache/calcite/pull/950#discussion_r259598356
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableInterpretable.java
 ##########
 @@ -82,6 +89,16 @@ public Node implement(final InterpreterImplementor 
implementor) {
     return new EnumerableNode(enumerable, implementor.compiler, this);
   }
 
+  private static final int BINDABLE_CACHE_MAX_SIZE =
+      Util.getIntProperty("calcite.bindable.cache.maxSize", (size) -> size >= 
0, 0);
+  private static final int BINDABLE_CACHE_CONCURRENCY_LEVEL =
+      Util.getIntProperty("calcite.bindable.cache.concurrencyLevel", (level) 
-> level > 0, 1);
+  private static final Cache<String, Bindable> BINDABLE_CACHE =
 
 Review comment:
   Thanks for your time and the comments @asereda-gs , @julianhyde . 
   
   I would like to highlight a few points.
   1. The cache in this class is rather low level since we are storing the java 
code it self (as a string) and not an SQL query or a plan. This is not memory 
efficient but solves the main performance penalty of class loading (JIT etc.) 
without big risk of side effects.
   2. The cache was added at this level to benefit clients using Calcite as a 
library and as a server. Clients can benefit from it either by passing through 
CalcitePrepare and also by calling directly 
`EnumerableInterpretable#toBindable`.
   3. The most important performance gain comes from queries which are executed 
frequently (consecutively) over a very short period of time. This cache is 
simple and at the same time solves the problem for the most common appearing 
patterns. 
   
   For the reasons outlined above I do not see a big benefit having separate 
caches per schema, connection, or something else but I may have underestimated 
some aspect. 
   
   Correct me if I am wrong but from your comments I get the impression that 
you are not in favor of merging this PR. I would like to include it in 1.19 but 
obviously I will not proceed if you are not ok with it.

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


With regards,
Apache Git Services

Reply via email to