#35572: Improve performance replacing os.listdir() with os.scandir()
-------------------------------------+-------------------------------------
     Reporter:  Paolo Melchiorre     |                     Type:
                                     |  Cleanup/optimization
       Status:  new                  |                Component:
                                     |  Uncategorized
      Version:  dev                  |                 Severity:  Normal
     Keywords:  scandir listdir      |             Triage Stage:
  python os                          |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
 Use `os.scandir()` instead of `os.listdir()` in the remaining occurrences
 in the code:
 https://github.com/search?q=repo%3Adjango%2Fdjango+os.listdir&type=code

 Based on the [https://docs.python.org/3/library/os.html#os.scandir Python
 documentation]
 > Using scandir() instead of listdir() can significantly increase the
 performance of code that also needs file type or file attribute
 information, because os.DirEntry objects expose this information if the
 operating system provides it when scanning a directory.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35572>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107019072adfd06-480830d2-0bb2-4d98-8a11-533ac1fb818d-000000%40eu-central-1.amazonses.com.

Reply via email to