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

Reuse TextLayoutInfo in queue_text #14997

Merged
merged 2 commits into from
Sep 2, 2024
Merged

Conversation

UkoeHB
Copy link
Contributor

@UkoeHB UkoeHB commented Aug 31, 2024

Objective

Don't reallocate TextLayoutInfo every time it needs to be updated.

Solution

Reuse existing allocation.

@@ -183,7 +183,9 @@ pub fn update_text2d_layout(
.map(|height| scale_value(height, scale_factor)),
};

let text_layout_info = text_layout_info.into_inner();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will trigger change detection even if queue_text returns an error. Doesn't seem important.

@alice-i-cecile alice-i-cecile added C-Performance A change motivated by improving speed, memory usage or compile times A-Text Rendering and layout for characters D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Aug 31, 2024
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Sep 2, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Sep 2, 2024
Merged via the queue into bevyengine:main with commit 2b94a10 Sep 2, 2024
31 checks passed
@UkoeHB UkoeHB deleted the text_opt branch September 2, 2024 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Text Rendering and layout for characters C-Performance A change motivated by improving speed, memory usage or compile times D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants