Source:
<code>protected void dispatchFinalAggregations(PendingOpsRequest request) { VoltTable digestScanResults = request.aggregateTables[0]; VoltTable scanResults = request.aggregateTables[2]; Map<String, Snapshot> aggregates = new HashMap<String, Snapshot>(); while (scanResults.advanceRow()) { if (scanResults.getString("RESULT").equals("SUCCESS") && scanResults.getString("READABLE").equals("TRUE") && scanResults.getString("COMPLETED").equals("TRUE")) { hashToSnapshot(scanResults, aggregates); } } while (digestScanResults.advanceRow()) { if (digestScanResults.getString("RESULT").equals("SUCCESS")) { hashDigestToSnapshot(digestScanResults, aggregates); } } List<ClientResultRow> clientResults = new ArrayList<ClientResultRow>(); for (Snapshot s : aggregates.values()) { clientResults.add(new ClientResultRow( (String)s.asRow()[0], (String)s.asRow()[1], <START> (String)s.asRow()[2], <END> (long)s.asRow()[3], (long)s.asRow()[4], (long)s.asRow()[5], (String)s.asRow()[6], (String)s.asRow()[7], (String)s.asRow()[8], (String)s.asRow()[9] )); } Collections.sort(clientResults, new Comparator<ClientResultRow>() { @Override public int compare(ClientResultRow r1, ClientResultRow r2) { return r1.compareTo(r2); } }); VoltTable clientSortedResults = constructClientResultsTable(); for (ClientResultRow row : clientResults) { clientSortedResults.addRow( row.path, row.pathType, row.nonce, row.txnid, row.created, row.size, row.tablesRequired, row.tablesMissing, row.tablesIncomplete, row.complete ); } request.aggregateTables[0] = clientSortedResults; }</code><technical_language>Adding more call asRow . identical calls asRow justify factoring out call operating resulting Object array? matter asRow initializes a new array (the slow way) calls 4 other functions loops map lookups string building</technical_language>

Target:
protected void dispatchFinalAggregations(PendingOpsRequest request) { VoltTable digestScanResults = request.aggregateTables[0]; VoltTable scanResults = request.aggregateTables[2]; Map<String, Snapshot> aggregates = new HashMap<String, Snapshot>(); while (scanResults.advanceRow()) { if (scanResults.getString("RESULT").equals("SUCCESS") && scanResults.getString("READABLE").equals("TRUE") && scanResults.getString("COMPLETED").equals("TRUE")) { hashToSnapshot(scanResults, aggregates); } } while (digestScanResults.advanceRow()) { if (digestScanResults.getString("RESULT").equals("SUCCESS")) { hashDigestToSnapshot(digestScanResults, aggregates); } } List<ClientResultRow> clientResults = new ArrayList<ClientResultRow>(); for (Snapshot s : aggregates.values()) { Object row[] = s.asRow(); clientResults.add(new ClientResultRow( (String)row[0], (String)row[1], (String)row[2], (long)row[3], (long)row[4], (long)row[5], (String)row[6], (String)row[7], (String)row[8], (String)row[9] )); } Collections.sort(clientResults, new Comparator<ClientResultRow>() { @Override public int compare(ClientResultRow r1, ClientResultRow r2) { return r1.compareTo(r2); } }); VoltTable clientSortedResults = constructClientResultsTable(); for (ClientResultRow row : clientResults) { clientSortedResults.addRow( row.path, row.pathType, row.nonce, row.txnid, row.created, row.size, row.tablesRequired, row.tablesMissing, row.tablesIncomplete, row.complete ); } request.aggregateTables[0] = clientSortedResults; }