dateparser icon indicating copy to clipboard operation
dateparser copied to clipboard

postpone timezone regex evaluation until first use - shaves off time from package import

Open beda42 opened this issue 1 year ago • 0 comments

This MR is related to issue #533 which is caused mainly by a time intensive parsing of regular expressions for timezone matching. This MR introduces a global object TzRegexCache and moves preparation of the regexps into it. The regexps are no longer parsed on startup, but during first use instead. On my machine it shaves off about 200 ms from the import time of dateparser thus reducing it to less than 20 % of the original import time.

beda42 avatar Sep 07 '23 12:09 beda42