| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
https://build.opensuse.org/request/show/1170193 by user mia + anag+factory - Update to 0.28.1 * fix: reduce memory footprint when loading TLDs gh#python-validators/validators#362 * fix: rfc cases in the domain validator gh#python-validators/validators#367 * chore: documentation maintenance gh#python-validators/validators#368
|
This significantly slows down TLD lookup. Opening a file and scanning it for every email validation is very inefficient. Is the memory footprint that much of a concern? Would you be open to changing it back to something like this, which is 10 times faster? _iana_tld_set = None
def _iana_tld():
global _iana_tld_set
if _iana_tld_set:
return _iana_tld_set
with Path(__file__).parent.joinpath("_tld.txt").open() as tld_f:
_ = next(tld_f)
_iana_tld_set = {line.strip() for line in tld_f}
return _iana_tld_set |
Sorry, something went wrong.
That's true for repeated validations.
Yes, if the file is too, large and/or, system memory is insufficient. What about a load_iana_tld() method? It will load and store the TLDs once. If that method isn't called, it'll lookup the file every time. Associate that method with a dataclass, instead of using global variables. A PR is welcome. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
No description provided.