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

make $pullAll more efficient

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 2.1.1
    • Fix Version/s: 2.2.0-rc0
    • Component/s: None
    • Labels:
      None

      Description

      It appears that the $pullAll operator is implemented inefficiently. The current implementation loops over the target array and for each element, loops over the set of things to pull. So if you are pulling m elements from an array of size n, this takes O(n*m) time. It is possible to do this in O(n+m) by using a hash table to loop once over things to pull, then once over the target array. The difference might be noticeable for large values of m and n.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: