Optimize thread safe code and replace the synchronized class "StringBuffer" by an unsynchronized one "StringBuilder". (#2704)