Too much memory allocated.
Without this dateparser, my service takes 5M memory. It takes 50M after I use this date parser to parse dates.
My question is, why it takes so much memory and, if possible, how to minimise the memory allocation of this module? Thanks.
Thanks for the report. This is a known issue. The problem occurs because dateparser uses a lot of regular expressions -- almost 4,000! -- across all locales. All of them are compiled at initialization time, which leads to high memory usage. For reference, in my benchmark, this package uses around 24 MB just for initializing the regex.
Unfortunately, there's nothing you, as an end user, can do, since the regex compilation happens during initialization, not during parsing.
I do have plans to pre-compile the regex using something like re2go, but I haven’t had the time or resources to work on it yet. I’ll keep this issue open to track it.