-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Shave ~90K off regex in native aot #80884
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
Conversation
- ifdef out some code only used in debug but that included a static which was rooting some of the methods - Avoid using a ValueTuple`7 as a dictionary key and instead use a custom struct - Remove a Sort call that was leftover from debugging but isn't necessary for correctness or performance - Avoid using a `HashSet<UnicodeCategory>` when a `bool[30]` would suffice - Avoid a generic instantation for a `Dictionary<enum,object,object>` by changing it to `Dictionary<int,object,object>`, which we already use in the same type
|
Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions Issue Details
This: using System.Text.RegularExpressions;
internal class Program
{
static void Main()
{
Console.WriteLine(new Regex("a", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase).IsMatch("abc"));
}
}published for Windows x64 native aot drops from 3618K to 3529K.
|
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.
This is great!
LGTM. Thanks
.../System.Text.RegularExpressions/src/System/Text/RegularExpressions/Symbolic/CharSetSolver.cs
Outdated
Show resolved
Hide resolved
...em.Text.RegularExpressions/src/System/Text/RegularExpressions/Symbolic/RegexNodeConverter.cs
Outdated
Show resolved
Hide resolved
Sounds like #76513? |
|
Tagging subscribers to 'size-reduction': @eerhardt, @SamMonoRT, @marek-safar Issue Details
This: using System.Text.RegularExpressions;
internal class Program
{
static void Main()
{
Console.WriteLine(new Regex("a", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase).IsMatch("abc"));
}
}published for Windows x64 native aot drops from 3618K to 3529K.
|
* Shave ~100K off regex in native aot - ifdef out some code only used in debug but that included a static which was rooting some of the methods - Avoid using a ValueTuple`7 as a dictionary key and instead use a custom struct - Remove a Sort call that was leftover from debugging but isn't necessary for correctness or performance - Avoid using a `HashSet<UnicodeCategory>` when a `bool[30]` would suffice - Avoid a generic instantation for a `Dictionary<enum,object,object>` by changing it to `Dictionary<int,object,object>`, which we already use in the same type * Address PR feedback
HashSet<UnicodeCategory>when abool[30]would sufficeDictionary<enum,object,object>by changing it toDictionary<int,object,object>, which we already use in the same typeThis:
published for Windows x64 native aot drops from 3618K to 3529K.