Unverified 提交 285f7ff9 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov 提交者: GitHub

Merge pull request #1546 from vbauer/feature/arraycopy

Tiny optimization: use `System.arraycopy` when possible
......@@ -336,9 +336,7 @@ public class Aggregate extends AbstractAggregate {
array[i + 1] = o.expression.getValue(session);
}
} else {
for (int i = 1; i <= size; i++) {
array[i] = remembered[i];
}
System.arraycopy(remembered, 1, array, 1, size);
}
v = ValueArray.get(array);
}
......
......@@ -10,6 +10,8 @@ import org.h2.result.ResultInterface;
import org.h2.result.SearchRow;
import org.h2.value.Value;
import java.util.Arrays;
/**
* A cursor for a function that returns a JDBC result set.
*/
......@@ -29,10 +31,7 @@ public class FunctionCursorResultSet extends AbstractFunctionCursor {
if (result != null && result.next()) {
int columnCount = result.getVisibleColumnCount();
Value[] currentRow = result.currentRow();
values = new Value[columnCount];
for (int i = 0; i < columnCount; i++) {
values[i] = currentRow[i];
}
values = Arrays.copyOf(currentRow, columnCount);
} else {
values = null;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论