SortedSet: Enable set comparision operations on views, and improve performance
[mono.git] / mcs / class / System / System.Text.RegularExpressions / interpreter.cs
index 6506953ce878536011a6e8252fc79da0179d0e67..0edc3239f6b177cb4c614ae99b2617dc553c2b04 100644 (file)
@@ -1016,6 +1016,11 @@ namespace System.Text.RegularExpressions {
                        int n_caps, first_mark_index;
                        Group g;
                        GetGroupInfo (0, out first_mark_index, out n_caps);
+
+                       // Avoid fully populating the Match instance if not needed
+                       if (!needs_groups_or_captures)
+                               return new Match (regex, this, text, text_end, 0, marks [first_mark_index].Index, marks [first_mark_index].Length);
+
                        Match retval = new Match (regex, this, text, text_end, groups.Length, 
                                                  marks [first_mark_index].Index, marks [first_mark_index].Length, n_caps);
                        PopulateGroup (retval, first_mark_index, n_caps);