-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
Cache function pointers in global tables #387
Merged
Merged
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
Uses raw FFI for construction and destruction, as the builtin classes are not yet available at the time.
Bromeon
added
feature
Adds functionality to the library
c: engine
Godot classes (nodes, resources, ...)
labels
Aug 22, 2023
API docs are being generated and will be shortly available at: https://godot-rust.github.io/docs/gdext/pr-387 |
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Aug 26, 2023
Bromeon
force-pushed
the
qol/cached-function-pointers
branch
3 times, most recently
from
September 2, 2023 21:03
d17e665
to
2a6964f
Compare
Bromeon
force-pushed
the
qol/cached-function-pointers
branch
from
September 4, 2023 08:03
2a6964f
to
4514542
Compare
# Conflicts: # godot-macros/src/method_registration/mod.rs # godot-macros/src/method_registration/register_method.rs # godot-macros/src/method_registration/virtual_method_callback.rs
Bromeon
force-pushed
the
qol/cached-function-pointers
branch
from
September 5, 2023 18:42
4514542
to
0c89812
Compare
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.
🔥 Detailed article here: https://godot-rust.github.io/dev/ffi-optimizations-benchmarking
Instead of repeatedly loading method pointers from Godot for each FFI call (including all the expensive
StringName
construction), this PR preloads all function pointers at startup. Includes:This not only improves performance (#11), but also reveals any incompatibilitities or missing methods in Godot immediately. For example, this helped reveal godotengine/godot#80852. On the downside, a single method can prevent gdext from loading (even if that method is not used); however this likely points to an incompatibility that needs to be addressed anyway.
Other changes in this PR include:
StringCache
for cachingStringName
instances during initializationinit
API which is easier to use and closer to what Godot providesExtensionLayer
,InitHandle
Still missing:
ThemeDB
)Editor
init-level (our binaries don't boot the editor, so that init-level is skipped in CI)ExtensionLibrary::min_level()
Scene
is specified as a minimum. What is its use then?After everything's been done, the codegen crate needs a heavy refactoring. Contributors planning to change that area are recommended to wait a bit.