Source:
<code>private void putForSingleHost(String kvsMethodName, final InetSocketAddress host, final TableReference tableRef, final Iterable<Map.Entry<Cell, Value>> values, boolean overwriteTimestamps) throws Exception { clientPool.runWithRetryOnHost(host, new FunctionCheckedException<CassandraClient, Void, Exception>() { @Override public Void apply(CassandraClient client) throws Exception { int mutationBatchCount = config.mutationBatchCount(); int mutationBatchSizeBytes = config.mutationBatchSizeBytes(); for (List<Map.Entry<Cell, Value>> partition : IterablePartitioner.partitionByCountAndBytes( values, mutationBatchCount, mutationBatchSizeBytes, tableRef, ENTRY_SIZING_FUNCTION)) { MutationMap map = new MutationMap(); for (Map.Entry<Cell, Value> e : partition) { Cell cell = e.getKey(); Column col = CassandraKeyValueServices.createColumn(cell, e.getValue()); <START> if (overwriteTimestamps) { <END> col = CassandraKeyValueServices.createColumnAndOverwriteTimestamp(cell, e.getValue()); } ColumnOrSuperColumn colOrSup = new ColumnOrSuperColumn(); colOrSup.setColumn(col); Mutation mutation = new Mutation(); mutation.setColumn_or_supercolumn(colOrSup); map.addMutationForCell(cell, tableRef, mutation); } queryRunner.batchMutate(kvsMethodName, client, ImmutableSet.of(tableRef), map, writeConsistency); } return null; } @Override public String toString() { return "batch_mutate(" + host + ", " + tableRef.getQualifiedName() + ", " + Iterables.size(values) + " values)"; } }); }</code><technical_language>This is wasteful end calling createColumn - this matters more if is large, extract twice. easy avoid: Column col = overwriteTimestamps ? CassandraKeyValueServices.createColumnAndOverwriteTimestamp(cell, e.getValue()) : CassandraKeyValueServices.createColumn(cell, e.getValue());</technical_language>

Target:
private void putForSingleHost(String kvsMethodName, final InetSocketAddress host, final TableReference tableRef, final Iterable<Map.Entry<Cell, Value>> values, boolean overwriteTimestamps) throws Exception { clientPool.runWithRetryOnHost(host, new FunctionCheckedException<CassandraClient, Void, Exception>() { @Override public Void apply(CassandraClient client) throws Exception { int mutationBatchCount = config.mutationBatchCount(); int mutationBatchSizeBytes = config.mutationBatchSizeBytes(); for (List<Map.Entry<Cell, Value>> partition : IterablePartitioner.partitionByCountAndBytes( values, mutationBatchCount, mutationBatchSizeBytes, tableRef, ENTRY_SIZING_FUNCTION)) { MutationMap map = new MutationMap(); for (Map.Entry<Cell, Value> e : partition) { Cell cell = e.getKey(); Column col = overwriteTimestamps ? CassandraKeyValueServices.createColumn(cell, e.getValue()) : CassandraKeyValueServices.createColumn( cell, e.getValue(), freshTimestampSupplier.get()); ColumnOrSuperColumn colOrSup = new ColumnOrSuperColumn(); colOrSup.setColumn(col); Mutation mutation = new Mutation(); mutation.setColumn_or_supercolumn(colOrSup); map.addMutationForCell(cell, tableRef, mutation); } queryRunner.batchMutate(kvsMethodName, client, ImmutableSet.of(tableRef), map, writeConsistency); } return null; } @Override public String toString() { return "batch_mutate(" + host + ", " + tableRef.getQualifiedName() + ", " + Iterables.size(values) + " values)"; } }); }