Skip to content

Commit

Permalink
Set an appropriate List HashMap capacity to reduce the number of capa…
Browse files Browse the repository at this point in the history
…city expansions. (#445)
  • Loading branch information
YangYumings authored Sep 18, 2024
1 parent bddf3d0 commit 9fe6209
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
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

0 comments on commit 9fe6209

Please sign in to comment.