Tiny optimization in find()

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Duplicate
    • Priority: Trivial - P5
    • 2.3
    • Affects Version/s: 2.1.1
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The PyMongo Cursor returns results from a batch by doing self.__data.pop(0) for each element. This requires quadratic time over the size of the batch. In tests, Python can do pop(0) on a 16k-element list in 3 or 4 microseconds, so it's not a big problem. But reversing the list and doing pop() might save a couple microseconds for big queries.

              Assignee:
              A. Jesse Jiryu Davis
              Reporter:
              A. Jesse Jiryu Davis
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: