提交 88ad5a36 authored 作者: Noel Grandin's avatar Noel Grandin

don't use substring when doing StringBuffer#append

reduces garbage
上级 d36834f9
......@@ -2066,7 +2066,7 @@ public class Function extends Expression implements FunctionCall {
if (buff == null) {
buff = new StringBuilder(size);
if (i > 0) {
buff.append(original.substring(0, i));
buff.append(original, 0, i);
}
}
if (index < replaceSize) {
......
......@@ -551,7 +551,7 @@ public class Csv implements SimpleRowSource {
buff.append(chars[idx + 1]);
start = idx + 2;
}
buff.append(s.substring(start));
buff.append(s, start, s.length());
return buff.toString();
}
......
......@@ -583,7 +583,7 @@ public class StringUtils {
}
int n = s.indexOf('\n', i);
n = n < 0 ? s.length() : n + 1;
buff.append(s.substring(i, n));
buff.append(s, i, n);
i = n;
}
if (newline && !s.endsWith("\n")) {
......
......@@ -213,7 +213,7 @@ public class TestScript extends TestBase {
// do nothing
} else if (sql.endsWith(";")) {
write(sql);
buff.append(sql.substring(0, sql.length() - 1));
buff.append(sql, 0, sql.length() - 1);
sql = buff.toString();
buff = new StringBuilder();
process(sql);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论