Home

Awesome

FastString

Alternative to the StringBuilder class for Unity games, with minimal memory allocation and faster performance. Based on FastString by Nicolas Gadenne of Gaddy Games

The class has been designed to be most useful in common game situations: a concatenation of a few string and data, then used by a Unity api method as an immutable string - every frame. It handles Append() and Replace() without doing any allocation, except for very rare capacity augmentation (contrary to StringBuilder which surprisingly does capacity change very often). It also appends float and int numbers without any allocation.

The only common memory allocation is when you retrieve the final immutable string - but this is only done when required.

Running the tests

A Unity project is provided for testing the performance.