Skip to content

Commit

Permalink
Use ArrayList to optimize executeBatch performance
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyingZC committed Nov 23, 2023
1 parent 3aff42f commit 449404d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import lombok.ToString;
import org.apache.shardingsphere.infra.executor.sql.context.ExecutionUnit;

import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
Expand Down Expand Up @@ -66,7 +67,7 @@ public List<List<Object>> getParameterSets() {
if (executionUnit.getSqlUnit().getParameters().isEmpty() || 0 == actualCallAddBatchTimes) {
result.add(Collections.emptyList());
} else {
result.addAll(Lists.partition(executionUnit.getSqlUnit().getParameters(), executionUnit.getSqlUnit().getParameters().size() / actualCallAddBatchTimes));
result.addAll(Lists.partition(new ArrayList<>(executionUnit.getSqlUnit().getParameters()), executionUnit.getSqlUnit().getParameters().size() / actualCallAddBatchTimes));
}
return result;
}
Expand Down

0 comments on commit 449404d

Please sign in to comment.