[.NET] Too many objects due to non-compiled Regex usage #2386
theolivenbaum
started this conversation in
General
Replies: 1 comment
-
Another interesting issue is the fact that all languages are being loaded in memory, despite the fact that only one language is being used - seems to be related to this method. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm doing some internal memory allocation benchmark on our C# code, and I noticed that a large portion of our object graph is due the usage of the RecognizersText library - there are over 3000 Regex objects created when using the English DateTimeRecognizer alone, which results in over 730k RegexNode objects, 175k RegexNode[] and 175k List objects. All in all about 40% of our object count is due the usage of the library - which seems quite excessive...
This traces down to the static constructors of the models, like for example: EnglishTimeExtractorConfiguration
Would it be possible to add a global / local flag to use compiled Regex instead?
Beta Was this translation helpful? Give feedback.
All reactions