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

Pymongo import is extremely slow on windows

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.7.3
    • Affects Version/s: None
    • Component/s: None
    • None
    • Python Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Detailed steps to reproduce the problem?

      It takes more than 500ms to import pymongo on windows 11.

      `python -c "import time; start = time.perf_counter(); import pymongo; print(time.perf_counter() - start)"`
      0.5733743999153376

       

      Generating an import trace: (visualisation attached)

      `python -X importtime -c "import pymongo; print(pymongo._version_)" 2> imports.log`

      Definition of done: what must be done to consider the task complete?

      Should not take more than 100ms just to import pymongo

      The exact Python version used, with patch level:

      $ python -c "import sys; print(sys.version)"

      3.12.0 (tags/v3.12.0:0fb18b0, Oct  2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)]

      The exact version of PyMongo used, with patch level:

      $ python -c "import pymongo; print(pymongo.version); print(pymongo.has_c())"

      4.7.2
      True

      The operating system and version (e.g. Windows 7, OSX 10.8, ...)

      Windows 11

        1. imports.log
          33 kB
        2. image-2024-05-23-14-56-29-282.png
          image-2024-05-23-14-56-29-282.png
          339 kB

            Assignee:
            steve.silvester@mongodb.com Steve Silvester
            Reporter:
            cvijdea@bitdefender.com Cristian Vîjdea
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: