Opened 10 years ago
Closed 10 years ago
#25322 closed Cleanup/optimization (fixed)
Lazily compile core.validators regular expressions
| Reported by: | Jonas Haag | Owned by: | nobody |
|---|---|---|---|
| Component: | Core (Other) | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Avoiding a lot of slow re.compile() calls at the module-level in django.core.validators can save a few hundred milliseconds when importing the module for the first time, which is a significant speedup to the django-admin command (and possibly other places as well).
Benchmarks using time django-admin:
- master:
- Python 2:
0.56 real 0.49 user 0.06 sys - Python 3:
0.56 real 0.52 user 0.03 sys
- Python 2:
- patched:
- Python 2:
0.26 real 0.20 user 0.05 sys - Python 3:
0.35 real 0.31 user 0.03 sys
- Python 2:
Change History (2)
comment:1 by , 10 years ago
| Triage Stage: | Unreviewed → Ready for checkin |
|---|
comment:2 by , 10 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
In 2bb1027d: