Tsdoc: IStringBuilder and StringBuilder usage

Created on 27 Nov 2018  路  1Comment  路  Source: microsoft/tsdoc

In JavaScript usually there is no need for a StringBuilder. Are you sure it helps the performance? AFAIK += for strings is fast in every browser, it's only necessary if you implement batch operations, eg. a batchAppend(string[]) method.

Most helpful comment

Hmm... you might be right. I had not gotten around to tuning perf yet. The main idea was to abstract the string building, so that if some technique is found to be faster, we only need to change one place.

Looks like the TypeScript compiler has an EmitTextWriter abstraction, but its inner loop just uses +=.

>All comments

Hmm... you might be right. I had not gotten around to tuning perf yet. The main idea was to abstract the string building, so that if some technique is found to be faster, we only need to change one place.

Looks like the TypeScript compiler has an EmitTextWriter abstraction, but its inner loop just uses +=.

Was this page helpful?
0 / 5 - 0 ratings