Speed up SBE walkField by checking field name before callback

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • 200
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Here is a scenario where SPM-4040 EFP is slower than classic.

      def document_generator() -> Generator[dict[str, Any], None, None]:
          for _ in range(cls.config.document_count):
              # Generate 1000 random fields for data level
              data_fields = {f"field_{i}": cls.random.randint(0, 1000) for i in range(1000)}
              # Generate 1000 random fields for a level
              a_fields = {f"field_{i}": cls.random.randint(0, 1000) for i in range(1000)}
              # Add field "a" with its nested structure
              data_fields["a"] = {
                  **a_fields,
                  "b": {
                      "c": cls.random.randint(0, 100),
                      "d": cls.random.randint(0, 100),
                      "e": cls.random.randint(0, 100),
                  },
              }
              yield {"data": data_fields}
      
      [
          {
              "$project": {
                  "_id": 0,
                  "c": "$data.a.b.c",
                  "d": "$data.a.b.d",
                  "e": "$data.a.b.e",
              }
          },
          {"$_internalInhibitOptimization": {}},
          {"$skip": self.config.document_count + 1},
      ]
      

      (see PERF-7392 for the code context).

      Here's where the code was added in SERVER-110354.
      https://github.com/10gen/mongo/pull/41483/files#diff-4afacbb225c523541e995791b85acc959c958fa30ca13b385a3e50ad0fb3a74aR182

            Assignee:
            Evan Bergeron
            Reporter:
            Evan Bergeron
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: