Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Alternative to StringBuilder class for Unity games, with minimal memory allocation and faster performance.

License

Notifications You must be signed in to change notification settings

snozbot/FastString

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

  • To run the performance tests, open the FastStringTest scene and the Profiler ( Window > Profiler ).
  • Run the scene in the editor and then stop it again.
  • Enter 'Test' in the profile search to see the profile results for each technique.

About

Alternative to StringBuilder class for Unity games, with minimal memory allocation and faster performance.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.