Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-330

Tiny optimization in find()

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial - P5
    • Resolution: Duplicate
    • 2.1.1
    • 2.3
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              jesse@mongodb.com A. Jesse Jiryu Davis
              jesse@mongodb.com A. Jesse Jiryu Davis
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: