bc-java
bc-java copied to clipboard
Replace StringBuffer with StringBuilder
StringBuffer is a synchronized Appendable, useful when more than one publisher is appending text to the same Appendable, but a waste of resources when the object is created and consumed by the same method (e.g. various toString()).
Furthermore, in Java 21+ synchronization interferes with the pinning of virtual threads on the carrier thread, potentially slowing down the application if, while locking an object, a suspendable operation is performed (e.g. IO read / write or Thread.sleep())