Skip to content

Commit 3e7edf9

Browse files
committed
Reduce allocations when writing longs
StringBuilder.append(Long) allocates a temporary string, while StringBuilder.append(long) does not and writes digits directly.
1 parent 3ec7da7 commit 3e7edf9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/timgroup/statsd/NonBlockingStatsDClient.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ private void send(String aspect, final long value, Message.Type type, double sam
615615

616616
sendMetric(new StatsDMessage<Long>(aspect, type, value, sampleRate, timestamp, tags) {
617617
@Override protected void writeValue(StringBuilder builder) {
618-
builder.append(this.value);
618+
builder.append(this.value.longValue());
619619
}
620620
});
621621
}

0 commit comments

Comments
 (0)