Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-71352

Use linear builder-style compilation of EExpression

    XMLWordPrintableJSON

Details

    • Task
    • Status: Open
    • Major - P3
    • Resolution: Unresolved
    • None
    • None
    • None
    • QE 2023-02-06, QE 2023-02-20
    • 10

    Description

      Current compilation of EExpression that relies on following pattern:

       

      vm::CodeFragment compileDirect(CompileCtx& ctx) {
        vm::CodeFragment code;
        code.append ...
        return code;
      }

      this results in O(N*D) complexity, where N is size of expression and D is depth of tree.

       

      Instead, use linear compilation that uses the following pattern:

      struct CompileCtx {
          vm::CodeFragment* code;
      }; 
       
      void compileDirect(CompileCtx& ctx) {
       ctx.code->append ...
      }

      in most cases to achieve O(N).

      In complex cases, the compileDirect may still allowed to use separate vm::CodeFragments if needed.

       

      Attachments

        Issue Links

          Activity

            People

              anna.wawrzyniak@mongodb.com Anna Wawrzyniak
              anna.wawrzyniak@mongodb.com Anna Wawrzyniak
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: