Shave ~90K off regex in native aot (#80884)
authorStephen Toub <stoub@microsoft.com>
Fri, 20 Jan 2023 12:33:18 +0000 (07:33 -0500)
committerGitHub <noreply@github.com>
Fri, 20 Jan 2023 12:33:18 +0000 (07:33 -0500)
commit1c8b2de1b83478f071efab13eca8a8e49eff7af2
tree5543d8724891fe18b4d8f46987d454fc5d83cb16
parentce934fd5c2ef844aecd61bd71f392b7156503e80
Shave ~90K off regex in native aot (#80884)

* 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
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCharClass.cs
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Symbolic/CharSetSolver.cs
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Symbolic/RegexNodeConverter.cs
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Symbolic/SymbolicRegexBuilder.cs
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Symbolic/SymbolicRegexMatcher.cs
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Symbolic/SymbolicRegexNode.cs