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

make $pullAll more efficient

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.2.0-rc0
    • Affects Version/s: 2.1.1
    • Component/s: None
    • Labels:
      None

      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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            matulef Kevin Matulef
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: