#35572: Improve performance replacing os.listdir() with os.scandir()
-------------------------------------+-------------------------------------
     Reporter:  Paolo Melchiorre     |                    Owner:  Amir
         Type:                       |  Karimi
  Cleanup/optimization               |                   Status:  assigned
    Component:  Core (Other)         |                  Version:  dev
     Severity:  Normal               |               Resolution:
     Keywords:  scandir listdir      |             Triage Stage:  Accepted
  python os                          |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Amir Karimi):

 Replying to [comment:3 Tim Graham]:
 > The description makes it sound like this is a simple find and replace
 all, however, do all usages "also need file type or file attribute
 information"?
 Good point! Except this case:
 
https://github.com/django/django/blob/aa74c4083e047473ac385753e047e075e8f04890/scripts/manage_translations.py#L42
 I didn't find any other cases where file attributes (is_dir, etc) are
 needed, and only their names or the number of list_dir output are needed.
 The only edge that "scandir" may still have is its less memory consumption
 when it comes to large folders (which I suspect is the case in any of
 these usages)
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35572#comment:4>
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/0107019073a52f21-921626d7-5ce3-4bbe-96a6-43b3aa017509-000000%40eu-central-1.amazonses.com.

Reply via email to