tombentley commented on a change in pull request #10469:
URL: https://github.com/apache/kafka/pull/10469#discussion_r610624115



##########
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'm suggesting to just move the `new byte[recordSize]` outside the loop. 
Obviously the point of the PR is to _populate_ it inside the loop. If the `new 
byte[recordSize]` is inside the loop then with, e.g. a 1M record size and large 
`--num-records` there will be more GC pressure (unless and until the JIT 
figures out it can reuse the same memory). 




-- 
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


Reply via email to