提交 284e2b74 authored 作者: Thomas Mueller's avatar Thomas Mueller

Small performance optimization

上级 78375e9f
...@@ -380,8 +380,11 @@ public abstract class Table extends SchemaObjectBase { ...@@ -380,8 +380,11 @@ public abstract class Table extends SchemaObjectBase {
public void updateRows(Prepared prepared, Session session, RowList rows) public void updateRows(Prepared prepared, Session session, RowList rows)
throws SQLException { throws SQLException {
// remove the old rows // remove the old rows
int rowScanCount = 0;
for (rows.reset(); rows.hasNext();) { for (rows.reset(); rows.hasNext();) {
if ((rowScanCount++ & 127) == 0) {
prepared.checkCanceled(); prepared.checkCanceled();
}
Row o = rows.next(); Row o = rows.next();
rows.next(); rows.next();
removeRow(session, o); removeRow(session, o);
...@@ -389,7 +392,9 @@ public abstract class Table extends SchemaObjectBase { ...@@ -389,7 +392,9 @@ public abstract class Table extends SchemaObjectBase {
} }
// add the new rows // add the new rows
for (rows.reset(); rows.hasNext();) { for (rows.reset(); rows.hasNext();) {
if ((rowScanCount++ & 127) == 0) {
prepared.checkCanceled(); prepared.checkCanceled();
}
rows.next(); rows.next();
Row n = rows.next(); Row n = rows.next();
addRow(session, n); addRow(session, n);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论