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

🚧Improve font rendering and text measuring performance #626

Closed
6 of 11 tasks
CalvinWilkinson opened this issue Jun 29, 2023 · 6 comments
Closed
6 of 11 tasks

🚧Improve font rendering and text measuring performance #626

CalvinWilkinson opened this issue Jun 29, 2023 · 6 comments
Assignees
Labels
high-priority High Priority 🏎️performance Performance improvements preview Done while in preview stale Signifies that an issue is stale

Comments

@CalvinWilkinson
Copy link
Member

CalvinWilkinson commented Jun 29, 2023

Complete The Item Below

  • I have updated the title without removing the 🚧 emoji.

Description

Improve the performance and reduce the memory allocations of the font rendering and text measuring process.

The font rendering process currently generates a decent amount of allocations due to the manipulation of text and its measuring in the text rendering process. These allocations can be reduced by simply converting the incoming text characters to a Span<char> type and using the span instead of the string directly.

Warning This needs to be dealt with with great care. The font/text rendering system is complicated and brittle due to the nature of how the rendering works. Rendering font glyphs has a lot of moving parts and can easily be affected when changing code. Make sure to perform lots of manual testing and rely on unit tests to help with this.

The areas of interest will be the private method named RenderBase() in the FontRenderer class and the Measure() method in the Font class. Anywhere in the Font.Measure() call stack needs to be analyzed and improved. Most likely, introducing the Span<char> type will have a snowball effect throughout the system.

Note Pay attention to how line endings will be processed. Look into normalizing the endings when converting from a string to a Span<char> by simply filtering out the '\r' and '\r\n' line endings.
Unfortunately, our JetBrains account does not come with dotMemory as a tool to use to measure allocations. Use Visual Studio instead. Make sure to profile only a single piece of text in a single scene as a baseline first.

Acceptance Criteria

  • Base-line measurements collected
    • Base-line and new collection results attached to this issue
  • FontRenderer class improved
  • Font class improved

ToDo Items

  • Change type labels added to this issue. Refer to the Change Type Labels section below.
  • Priority label added to this issue. Refer to the Priority Type Labels section below.
  • Issue linked to the correct project (if applicable).
  • Issue linked to the correct milestone (if applicable).
  • Draft pull request created and linked to this issue (only required with code changes).

Issue Dependencies

Related Work

No response

Additional Information:

Change Type Labels

Change Type Label
Bug Fixes 🐛bug
Breaking Changes 🧨breaking changes
New Feature ✨new feature
CICD Changes ♻️cicd
Code Doc Changes 🗒️documentation/code
Product Doc Changes 📝documentation/product

Priority Type Labels

Priority Type Label
Low Priority low priority
Medium Priority medium priority
High Priority high priority

Code of Conduct

  • I agree to follow this project's Code of Conduct.
@CalvinWilkinson CalvinWilkinson added high-priority High Priority preview Done while in preview 🏎️performance Performance improvements labels Jun 29, 2023
@stale
Copy link

stale bot commented Sep 4, 2023

This issue has been automatically marked as stale due to the lack of activity for 60 days. The issue will be closed after 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Signifies that an issue is stale label Sep 4, 2023
@CalvinWilkinson CalvinWilkinson removed the stale Signifies that an issue is stale label Sep 4, 2023
Copy link

stale bot commented Nov 3, 2023

This issue has been automatically marked as stale due to the lack of activity for 60 days. The issue will be closed after 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Signifies that an issue is stale label Nov 3, 2023
@CalvinWilkinson CalvinWilkinson removed the stale Signifies that an issue is stale label Nov 4, 2023
Copy link

stale bot commented Jan 3, 2024

This issue has been automatically marked as stale due to the lack of activity for 60 days. The issue will be closed after 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Signifies that an issue is stale label Jan 3, 2024
@CalvinWilkinson CalvinWilkinson removed the stale Signifies that an issue is stale label Jan 3, 2024
Copy link

stale bot commented Mar 22, 2024

This issue has been automatically marked as stale due to the lack of activity for 60 days. The issue will be closed after 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Signifies that an issue is stale label Mar 22, 2024
@CalvinWilkinson CalvinWilkinson removed the stale Signifies that an issue is stale label Mar 23, 2024
Copy link

stale bot commented May 22, 2024

This issue has been automatically marked as stale due to the lack of activity for 60 days. The issue will be closed after 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Signifies that an issue is stale label May 22, 2024
Copy link

stale bot commented May 29, 2024

This stale issue has been closed due to a lack of activity.

@stale stale bot closed this as completed May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high-priority High Priority 🏎️performance Performance improvements preview Done while in preview stale Signifies that an issue is stale
Projects
Archived in project
Development

No branches or pull requests

1 participant