StringBuilder is not thread safe. So, it performs better in situations where thread safety is not required.
StringBuffer is implemented by using synchronized keyword on all methods.
StringBuffer
/* */ public synchronized StringBuffer append(String string)/* */ {/* 197 */ if (string == null) string = String.valueOf(string);/* 198 */ int adding = string.length();/* 199 */ int newSize = this.count + adding;/* 200 */ if (newSize > this.value.length) {/* 201 */ ensureCapacityImpl(newSize);/* */ }/* 203 */ string.getChars(0, adding, this.value, this.count);/* 204 */ this.count = newSize;/* 205 */ return this;/* */ }
StringBuilder
/* */ public StringBuilder append(String string)/* */ {/* 201 */ if (string == null) string = String.valueOf(string);/* 202 */ int adding = string.length();/* 203 */ int newSize = this.count + adding;/* 204 */ if (newSize > this.value.length) {/* 205 */ ensureCapacityImpl(newSize);/* */ }/* 207 */ string.getChars(0, adding, this.value, this.count);/* 208 */ this.count = newSize;/* 209 */ return this;/* */ }