String vs. StringBuilder

后端 未结 24 1529
眼角桃花
眼角桃花 2020-11-22 06:22

I understand the difference between String and StringBuilder (StringBuilder being mutable) but is there a large performance difference

24条回答
  •  没有蜡笔的小新
    2020-11-22 06:51

    Further to the previous answers, the first thing I always do when thinking of issues like this is to create a small test application. Inside this app, perform some timing test for both scenarios and see for yourself which is quicker.

    IMHO, appending 500+ string entries should definitely use StringBuilder.

提交回复
热议问题