-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improvement regex #1548
improvement regex #1548
Conversation
@EngRajabi I am not sure if that makes any good here.
Can you provide some bench marking to support your idea please? |
Yes, I did.It is a bit slow to use the first time, but much faster the next time |
@DavoudEshtehari and @Wraith2 any opinion on this? I think we should not sacrifice initialization time for runtime performance unless we have a good benchmark to show a practical test case. @EngRajabi can you write a test case with |
I looked at this when it was posted and my opinon was that it is not harmful. It's not in a heavily used code path for any performance benchmarks I've seen so it's not going to cause trouble for most people. If it is heavily used for a small number of people then this is probably an improvement for them. Ideally I'd like to see benchmark numbers but it's a single line change in a low traffic area that might benefit users so I'm not against it. We keep a reference the to the regex so we're not relying on the static regex cache we will do the work only once. On netfx compiled regex output an assembly which is going to cause codegen which is slow but if it's heavily used there may be an overall perf benefit. On netcore <7 compiled flag does nothing, on 7+ it may cause a build time code generator to generate the compiled expression which will be faster for users in all cases. |
Following the Wraith2 comment, it'll improve a small number of customers with high loads. Best Practices
|
Thanks for the explanation friends And the test I took The following should be noted in regular expressions |
improvement regex with compile flag