That microbench is taken out of context, «faster» there does not actually mean anything.
In an actual application where you would actually use the result instead of throwing it out immediately, char-by-char concatenation would consume up to an order of magnitude more memory and slow everything down.
My code to repoduce that is in a comment below, in another thread here.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
That microbench is taken out of context, «faster» there does not actually mean anything.
In an actual application where you would actually use the result instead of throwing it out immediately, char-by-char concatenation would consume up to an order of magnitude more memory and slow everything down.
My code to repoduce that is in a comment below, in another thread here.