SLF4J / SLF4J-471 [Open]
CharSequence and varargs

==============================

Here's what changed in this issue in the last few minutes.

There is 1 comment.

View or comment on issue using this link
https://jira.qos.ch/browse/SLF4J-471

==============================
 1 comment
------------------------------

Endre Stølsvik on 21/Oct/21 11:47 PM
One basic reason for why CharSequence is better, is that a StringBuilder is a 
CharSequence. Right now, I am constructing a message with lots of ifs-and-buts, 
and then when I want to log it, i _have to_ do .toString() on it, creating a 
new object with a new char-array.

But the other is what OP mentions: You might want to pre-allocate log char 
arrays for a thread, and then reuse them - avoiding object creations. This 
would actually work nicely with StringBuilders, using setLength(0) to "clear" 
them.


==============================
 This message was sent by Atlassian Jira (v8.8.0#808000-sha1:e2c7e59)

_______________________________________________
slf4j-dev mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/slf4j-dev

Reply via email to