-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
TextServerAdvanced: 2x performance improvement by removing redundant lookups #92575
Merged
akien-mga
merged 1 commit into
godotengine:master
from
rune-scape:rune-text-srvr-cacher
Aug 29, 2024
Merged
TextServerAdvanced: 2x performance improvement by removing redundant lookups #92575
akien-mga
merged 1 commit into
godotengine:master
from
rune-scape:rune-text-srvr-cacher
Aug 29, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7d3036b
to
e7b3339
Compare
bf9054c
to
ffa6459
Compare
ffa6459
to
186c993
Compare
efd0372
to
c60a94a
Compare
bruvzg
approved these changes
Jun 1, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing I would change is returning value from the _ensure_cache_for_size
as pointer instead of reference, to avoid unnecessary local variable which are unused in most cases.
- FontForSizeAdvanced *ffsd = nullptr;
- ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size, ffsd), 0);
+ ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size, nullptr), 0);
c60a94a
to
e0ce638
Compare
AThousandShips
approved these changes
Jul 4, 2024
Needs a rebase, which should show a compilation error (tested locally):
|
e0ce638
to
37d0d62
Compare
+ caching editor setting + using a faster hash method on the FontForSizeAdvanced cache + SafeFlag for ShapedTextDataAdvanced::valid
37d0d62
to
4ba7738
Compare
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
in total from my benchmark it takes ~39% of the time to render the same text in a Label (~45% in CodeEdit, the main script editor in godot)
all of these optimizations came from profiling a build using
target=editor optimize=speed_trace
they all gave at least a 10% improvement to speed at the time of profilingnow when profiled, the actual hotpath goes to freetype rendering and shaping and such
benchmark: TextServerTest.zip
benchmark compile flags:
scons target=template_release production=yes optimize=speed lto=full tests=yes deprecated=no scu_build=yes module_text_server_adv_enabled=yes module_text_server_fb_enabled=no
benchmark run command:
./godot/bin/godot.linuxbsd.template_release.x86_64 --disable-vsync ./TextServerTest/project.godot
results before:
after:
the last line of each is the most important, its the average of all frame times (minus some longer startup frames)
the same improvements can be made to TextServerFallback