You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Large regression in memory usage due to the change which allows unicode characters in EmailField (Python 2.7.x) #1832
Version 0.13.0 included a change which allows unicode (non-ascii) characters in the EmailField - 466935e.
This change seemed to have introduced a large regression in the memory usage of the code which uses EmailField and runs under Python 2.7.x.
I imagine that's due to precompiling of the new regular expression used on the EmailField and storing precompiled version in memory and some edge case / bug in CPython 2.7.x (the issue can only be reproduced under 2.7.x, but not 3.x).
As you can see, the memory usage increases by more than 3 times. Looking at the comment here (466935e#commitcomment-26845075), we are not the one people experiencing this issue.
Closing this, the lazy evaluation of the regexes addresses the issue for users that aren't using the EmailField. The regex from the EmailField and its lazy-evaluation were inspired by django's EmailField
Happy to reopen it if you see a way to improve this. Note that if you need to use EmailField but don't need the strict validation (which bring slowness and increased memory usage) from the current regex, you can easily subclass EmailField and use a simpler regex
Activity
Revert a change which causes a big regressions in EmailField memory
bagerard commentedon Jun 16, 2019
Closing this, the lazy evaluation of the regexes addresses the issue for users that aren't using the EmailField. The regex from the EmailField and its lazy-evaluation were inspired by django's EmailField
Happy to reopen it if you see a way to improve this. Note that if you need to use EmailField but don't need the strict validation (which bring slowness and increased memory usage) from the current regex, you can easily subclass EmailField and use a simpler regex