You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by GitBox <gi...@apache.org> on 2023/01/12 03:48:23 UTC
[GitHub] [rocketmq] mxsm commented on a diff in pull request #5870: [ISSUE #5859]Optimize String#format in DefaultMQProducerImpl
mxsm commented on code in PR #5870:
URL: https://github.com/apache/rocketmq/pull/5870#discussion_r1067672501
##########
client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:
##########
@@ -695,16 +695,13 @@ private SendResult sendDefaultImpl(
if (sendResult != null) {
return sendResult;
}
+ StringBuilder info = new StringBuilder(300);
+ info.append("Send [").append(times).append("] times, still failed, cost [")
+ .append(System.currentTimeMillis() - beginTimestampFirst).append("]ms, Topic: ").append(msg.getTopic())
+ .append(", BrokersSent: ").append(Arrays.toString(brokersSent))
+ .append(FAQUrl.suggestTodo(FAQUrl.SEND_MSG_FAILED));
Review Comment:
> It seems that the String.format is more readable here
This optimization has been done from a performance perspective. The performance of String.format is relatively poor and triggers an array expansion, which can be referenced in issue #5804 . However, readability has been reduced.Performance enhancement should be considered as the first priority.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org