Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4144

Reduce code generation and class loading overhead when getScalar in JaninoRexCompiler.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.24.0
    • None
    • core
    • version: calcite-core 1.24
      mode: filterableTable

    Description

      I used the FilterableTable mode in the project, but I found that the query was particularly slow. I used the JProfile tool to troubleshoot the thread time-consuming place, and then through the debug, I found that each request took two places:
      1、org.apache.calcite.adapter.enumerable.EnumerableInterpretable#getBindable

      This place optimizes the cache settings by setting the cache size.
      2、org.apache.calcite.interpreter.JaninoRexCompiler#baz

      But this place is not cached, and a new expression string is used every time to create it through reflection.
      JProfile tool time consumption:

      I originally wanted to add a layer of cache here, but found that the expressions generated each time are different, as follows:

      So you can't use the getBindable method to directly add cache.
      Is there anything you can optimize here? For example, can you generate a template class in advance, and then generate different objects through different parameter values?

      Bring tea to the boss!
      Looking forward to your reply!

      Attachments

        1. image-2020-07-27-22-44-44-455.png
          179 kB
          zhangchenghui
        2. image-2020-07-27-22-45-25-350.png
          306 kB
          zhangchenghui
        3. image-2020-07-27-22-45-54-346.png
          476 kB
          zhangchenghui
        4. image-2020-07-27-22-46-18-306.png
          70 kB
          zhangchenghui
        5. image-2020-07-29-13-48-53-028.png
          49 kB
          zhangchenghui

        Issue Links

          Activity

            People

              Unassigned Unassigned
              zhangchenghui zhangchenghui
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 96h
                  96h
                  Remaining:
                  Remaining Estimate - 96h
                  96h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified