michaeljmarshall opened a new pull request, #19619:
URL: https://github.com/apache/pulsar/pull/19619
### Motivation
We are try to minimize the number of strings allocated when generating
stats. This PR changes the logic to reduce allocations by storing string
references that are generated. Here is some of the code that we're calling:
```java
public String getClientVersion() {
return clientVersionOffset == -1 ? null
: stringBuffer.substring(clientVersionOffset,
clientVersionOffset + clientVersionLength);
}
```
Since each invocation of `getClientVersion` generates a new string, it is
better to get the string once and store it in a reference.
### Modifications
* Update certain string comparisons so that we do not regenerate the same
string multiple times.
### Verifying this change
This is a trivial rework that is covered by tests.
### Does this pull request potentially affect one of the following parts:
This is an internal optimization.
### Documentation
- [x] `doc-not-needed`
### Matching PR in forked repository
PR in forked repository: Skipping forked PR
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]