StringBuffer vs. StringBuilder

Поиск
Список
Период
Сортировка
От Frederik Wiers
Тема StringBuffer vs. StringBuilder
Дата
Msg-id CAP9CZQLD7JNWfGaUexXFEr_pi-Uiwz4srfBS=YkskU9CLGMw7g@mail.gmail.com
обсуждение исходный текст
Ответы Re: StringBuffer vs. StringBuilder  (Stephen Nelson <stephen@eccostudio.com>)
Re: StringBuffer vs. StringBuilder  (Dave Cramer <pg@fastcrypt.com>)
Список pgsql-jdbc
Hello,

suggestion for a small performance improvement: replace StringBuffer with StringBuilder when the StringBuffer is used as a local variable in a method.

I just browsed the git-repo (https://github.com/pgjdbc/pgjdbc/tree/master/org/postgresql) looking for prepared statement caching (which I could not find, but that is for another day) and saw a lot of places where StringBuffer can be replaced by StringBuilder.

The little performance test shown at http://stackoverflow.com/a/2771852/3080094
indicates that if StringBuffer is used a lot, replacing it with StringBuilder can make a difference. And I can not think of a reason to use a StringBuffer if it is just used locally in a method to build a String.

Frederik


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Andreas Joseph Krogh
Дата:
Сообщение: Re: Will Connection.createBlob be implemented any time soon?
Следующее
От: Stephen Nelson
Дата:
Сообщение: Re: StringBuffer vs. StringBuilder