Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set an appropriate List HashMap capacity to reduce the number of capacity expansions. #445

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public long getBatchNumber() {
/** Add one row into batch, row contains data from all sensors */
protected List<Object> generateOneRow(int deviceIndex, int colIndex, long stepOffset)
throws WorkloadException {
List<Object> values = new ArrayList<>();
List<Object> values = new ArrayList<>(config.getSENSOR_NUMBER());
int index = (int) (Math.abs(stepOffset * (deviceIndex + 1)) % config.getWORKLOAD_BUFFER_SIZE());
if (colIndex == -1) {
for (int i = 0; i < config.getSENSOR_NUMBER(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class SessionStrategy extends DMLStrategy {
static final Config config = ConfigDescriptor.getInstance().getConfig();

private static final Map<String, Binary> binaryCache =
new ConcurrentHashMap<>(config.getWORKLOAD_BUFFER_SIZE());
new ConcurrentHashMap<>(config.getWORKLOAD_BUFFER_SIZE(), 1.00f);
private final Session session;
private final IoTDB iotdb;

Expand Down