-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Best practices for regular expressions versus Regex
performance review
#1348
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's Ok
What if timeout happens? Timeout maybe not good practice here. |
Setting timeout is one of the necessary tasks of using regex. When a timeout occurs, it is best to run the entire project involved and not respond to others. |
Is there some reason for considering |
timeout is not customizable by the customer. Like many other settings. It was 100 ms when I adjusted it according to the tests I had. But we can decide here and change this time. We can set this time to 500 ms. If we do not receive an answer at this time, it is better not to involve the whole project in its implementation and let it respond to other requests. |
9ba1128
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
review done
Dear Mohsen, Why did you merge develop branch from your fork into the feature branch? Now there is no build at all and pipeline cannot run new build. Could you fix/update your fork develop branch please first? After that we will try to fix pipeline triggering by rebasing current feature branch onto develop one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did Branch Develop on Branch as Rebase. Does this solve this problem?
Now I see develop and it has zero diff, but the branch is not default. ☝️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change something for build
bfdecf7
to
4b9516c
Compare
Feature branch has been rebased onto develop! Going to start code review... I guess, this PR is not related to an issue, right? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ready for Final Code Review❕
The following items need verification:
- Define the
TimeSpan.FromMilliseconds(100)
parameter as a global static property to allow advanced configuration of this constant in C#. → Docs: Use time-out values - Convert all
Regex
definitions toGeneratedRegex
, following best practices in .NET 7+. See theOcelot.DependencyInjection.ConfigurationBuilderExtensions
class for an example, particularly theSubConfigRegex()
method →
#if NET7_0_OR_GREATER [GeneratedRegex(@"^ocelot\.(.*?)\.json$", RegexOptions.IgnoreCase | RegexOptions.Singleline, "en-US")] private static partial Regex SubConfigRegex(); #else private static readonly Regex SubConfigRegexVar = new(@"^ocelot\.(.*?)\.json$", RegexOptions.IgnoreCase | RegexOptions.Singleline, TimeSpan.FromMilliseconds(1000)); private static Regex SubConfigRegex() => SubConfigRegexVar; #endif
The preprocessorif
-directive is necessary to accommodate support fornet6.0
, as well as fornet7.0
andnet8.0
- Ensure that all
Regex
expressions are converted throughout the entire solution.
@EngRajabi Hello, Mohsen! Are you energized and ready to deliver this PR? 😄 |
Regex
improvements
…to all Regex objects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ready for Delivery ✅
Regex
improvementsRegex
performance review
Proposed changes
Regex
improvements:Regex
class is immutable)Links