tombentley commented on a change in pull request #10469: URL: https://github.com/apache/kafka/pull/10469#discussion_r610531203
########## File path: tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java ########## @@ -127,15 +122,22 @@ public static void main(String[] args) throws Exception { int currentTransactionSize = 0; long transactionStartTime = 0; for (long i = 0; i < numRecords; i++) { + + if (payloadFilePath != null) { + payload = payloadByteList.get(random.nextInt(payloadByteList.size())); + } else if (recordSize != null) { + payload = new byte[recordSize]; Review comment: I guess by allocating a new `byte[]` for each record and with big enough `recordSize` we'd generate quite a lot of garbage, so it might be better to allocate `payload` once outside the loop and just fill the buffer here. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org