#36190: High memory usage of CommonPasswordValidator
-------------------------------------+-------------------------------------
Reporter: Michel Le Bihan | Owner: Priyanshu
Type: | Singh Panda
Cleanup/optimization | Status: closed
Component: contrib.auth | Version: dev
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Accepted
CommonPasswordValidator |
Has patch: 0 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Michel Le Bihan):
Here is a simple benchmark:
{{{
(venv) michel@debian:/dev/shm$ python3 test.py
Reading password list took: 3.177845547
Checking if password is in list took: 2.2280000000485245e-06
Password is in list: False
Size of passwords in MB: 755.3031387329102
(venv) michel@debian:/dev/shm$ python3 test2.py
Reading password list took: 17.459581553
Checking if password is in list took: 1.1341000000442136e-05
Password is in list: False
Size of passwords in MB: 75.32260131835938
}}}
As you can see, reading the password list is much longer and not really
optimized. However, checking if a password is in the list is basically
instant and the memory usage reduction is significant. As for false
positives, I think that they are extremely unlikely. 64 bits is really a
lot.
--
Ticket URL: <https://code.djangoproject.com/ticket/36190#comment:14>
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 visit
https://groups.google.com/d/msgid/django-updates/010701951a976cb9-dd48a2b0-9869-431e-9365-52a20cec0d06-000000%40eu-central-1.amazonses.com.