Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do a Garbage Pass (on Non-Animation) #33

Open
edwardrowe opened this issue Jun 13, 2020 · 2 comments
Open

Do a Garbage Pass (on Non-Animation) #33

edwardrowe opened this issue Jun 13, 2020 · 2 comments
Labels

Comments

@edwardrowe
Copy link

There could be areas we are generating needless garbage. Especially consider:

  • String concatenation
  • Animating text mesh
  • any case of "new"
@edwardrowe
Copy link
Author

edwardrowe commented Jun 28, 2020

This actually won't be too bad. Found the following areas to tackle:

Tag Parsing:

  • ProcessCustomTags uses new Lists.
  • TextTagParser.CreateSymbolListFromText Creates a list of TextSymbols
  • RemoveTagsFromString uses substring which appears to allocate a new string
  • Lots of Substrings in RichTextTag. It stores the tag just as a full string instead of splitting it out, so every property call uses substring to figure out what part of the rich text tag it is... Best fix is to probably save these out. Could make RichTextTags read only so that they can easily cache the values.

Text Typing:

  • Pool Coroutine yields - could make a class that stores them and creates them if they're new. Maybe it's a queue and we pop them off when there are too many.

Animation:

@edwardrowe
Copy link
Author

Captured allocations when printing the color tags. Appears to be 334 KB (did it twice, same result both times).
Screen Shot 2020-06-28 at 12 41 19 AM

@edwardrowe edwardrowe changed the title Do a Garbage Pass Do a Garbage Pass (on Non-Animation) Jun 28, 2020
edwardrowe added a commit that referenced this issue Jun 30, 2020
This makes RichTextTag's Properties ReadOnly so that it's easier to
keep cached tag parts reliable. Then we can only call substring when
needed to construct the tag parts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant