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