Building large strings with += inside loops looks innocent but somehow destroys performance.
As developers we often find the need to construct large text strings, whether we are building xml export, massive json or a csv file, and our immediate instinct is to use +=
The Problem
String concatenation in loops. It is because strings are not able to be altered in memory after its value is set initially. Every time you use += the system doesn’t just add to the text, it has to:
➡️ Allocate new memory for the combined size.
➡️ Copy the old text over.
➡️ Add the new text.
➡️ Destroy the old object.
Well if you do this in a loop of massive records, the garbage collector has to work overtime.

The Fix
Use TextBuilder. It allocates a buffer of memory and simply “appends” new data to it without reallocating the whole object every time.
Instead of creating a new string each time, TextBuilder:
✅ Allocates a memory buffer upfront
✅ Appends new text to the buffer
✅ Only creates the final string when you call ToText()
One allocation. Linear performance. O(n) complexity.

Common use cases for TextBuilder:
👉 CSV/Excel exports
👉 XML generation
👉 JSON payloads
👉 Large HTML/email body construction
👉 Log file aggregation
👉 Base64 string handling
👉 Any loop that builds text

Quick refactoring checklist:
* Search your code for += inside repeat or for loops.
* Look for large string concatenation in exports.
* Check: Any XML/JSON/CSV generation code.
The Bottom line
If you are concatenating text inside a loop, stop using Text variables. Switch to TextBuilder. Your CPU and your users will thank you.