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

GDScript: Replace ptrcalls on MethodBind to validated calls #79893

Merged

Conversation

vnen
Copy link
Member

@vnen vnen commented Jul 25, 2023

This improves the performance of typed calls to engine methods when the argument types are exact.

Using validated calls delegate more of the work the core instead of doing argument unpacking in the VM. It also does not need different instructions for each return type, simplifying the code.

@vnen vnen added this to the 4.2 milestone Jul 25, 2023
@vnen vnen requested a review from a team as a code owner July 25, 2023 16:15
Copy link
Member

@adamscott adamscott left a comment

Choose a reason for hiding this comment

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

Approved during the GDScript team meeting. We only reviewed the PR on the form, not the content. We trust @vnen on the performance improvements.

@akien-mga
Copy link
Member

Might be worth a rebase and re-testing to ensure it still works as intended, since it was authored more than 2 months ago and we merged a bunch of changes in the meantime.

@dsnopek
Copy link
Contributor

dsnopek commented Oct 3, 2023

This may have negative performance implications on calling functions in GDExtensions. GDExtensionMethodBind converts all validated_call()s to call() rather than doing a proper ptrcall(). This is definitely a bug/short-coming in GDExtension which we should fix (and it certainly can be fixed in a separate PR), but I just thought I'd point it out.

@dsnopek
Copy link
Contributor

dsnopek commented Oct 4, 2023

I've made PR #82794 to address the GDExtension performance issue I brought up in my previous comment. I've tested it with this PR, and it seems to be working fine (the automated godot-cpp tests pass).

This improves the performance of typed calls to engine methods when the
argument types are exact.

Using validated calls delegate more of the work the core instead of
doing argument unpacking in the VM. It also does not need different
instructions for each return type, simplifying the code.
@vnen vnen force-pushed the gdscript-validated-method-bind-call branch from 1078978 to 4a7d49a Compare October 6, 2023 14:16
@akien-mga akien-mga merged commit 2f919f0 into godotengine:master Oct 6, 2023
15 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants