Skip to content

Commit 6e5fc27

Browse files
committed
[Soft] Fix some extra string allocations.
1 parent 69fdd3b commit 6e5fc27

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Mono.Debugging.Soft/SoftDebuggerSession.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,7 +2151,7 @@ string EvaluateTrace (ThreadMirror thread, string exp)
21512151
int i = exp.IndexOf ('{');
21522152
while (i != -1) {
21532153
if (i < exp.Length - 1 && exp [i+1] == '{') {
2154-
sb.Append (exp.Substring (last, i - last + 1));
2154+
sb.Append (exp, last, i - last + 1);
21552155
last = i + 2;
21562156
i = exp.IndexOf ('{', i + 2);
21572157
continue;
@@ -2161,12 +2161,12 @@ string EvaluateTrace (ThreadMirror thread, string exp)
21612161
break;
21622162
string se = exp.Substring (i + 1, j - i - 1);
21632163
se = EvaluateExpression (thread, se, null);
2164-
sb.Append (exp.Substring (last, i - last));
2164+
sb.Append (exp, last, i - last);
21652165
sb.Append (se);
21662166
last = j + 1;
21672167
i = exp.IndexOf ('{', last);
21682168
}
2169-
sb.Append (exp.Substring (last, exp.Length - last));
2169+
sb.Append (exp, last, exp.Length - last);
21702170
return sb.ToString ();
21712171
}
21722172

Mono.Debugging/Mono.Debugging.Evaluation/ObjectValueAdaptor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ public string EvaluateDisplayString (EvaluationContext ctx, object obj, string e
13191319
i = expr.IndexOf ('{', last);
13201320
}
13211321

1322-
display.Append (expr.Substring (last));
1322+
display.Append (expr, last, expr.Length - last);
13231323

13241324
return display.ToString ();
13251325
}

0 commit comments

Comments
 (0)