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

Optimize generated code #16675

Open
rolfbjarne opened this issue Nov 9, 2022 · 0 comments
Open

Optimize generated code #16675

rolfbjarne opened this issue Nov 9, 2022 · 0 comments
Labels
app-size enhancement The issue or pull request is an enhancement generator Issues affecting the generator good first issue This is a good first issue for someone to start working with our code performance If an issue or pull request is related to performance
Milestone

Comments

@rolfbjarne
Copy link
Member

There are numerous places where we can improve the generated code.

Example:

[MonoPInvokeCallback (typeof (DQLPreviewReplyDataCreationHandler))]
static unsafe IntPtr Invoke (IntPtr block, IntPtr reply, ref IntPtr error) {
    var descriptor = (BlockLiteral *) block;
    var del = (global::QuickLook.QLPreviewReplyDataCreationHandler) (descriptor->Target);
    var __xamarin_pref1 = Runtime.GetINativeObject<NSError> (error, false);
    Foundation.NSData retval = del ( Runtime.GetNSObject<QLPreviewReply> (reply), ref __xamarin_pref1);
    error = __xamarin_pref1 is null ? IntPtr.Zero : __xamarin_pref1.Handle;
    return retval.GetHandle ();
}
  • Runtime.GetINativeObject<NSError> should be GetNSObject
  • error = __xamarin_pref1 is null ? IntPtr.Zero : __xamarin_pref1.Handle; should be error = __xamarin_pref1.GetHandle ()`;

We should look at the generated code to find more opportunities.

@rolfbjarne rolfbjarne added enhancement The issue or pull request is an enhancement good first issue This is a good first issue for someone to start working with our code performance If an issue or pull request is related to performance generator Issues affecting the generator app-size labels Nov 9, 2022
@rolfbjarne rolfbjarne added this to the .NET 8 milestone Nov 9, 2022
@rolfbjarne rolfbjarne modified the milestones: .NET 8, .NET 9 Sep 11, 2023
@rolfbjarne rolfbjarne modified the milestones: .NET 9, .NET 10 Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app-size enhancement The issue or pull request is an enhancement generator Issues affecting the generator good first issue This is a good first issue for someone to start working with our code performance If an issue or pull request is related to performance
Projects
None yet
Development

No branches or pull requests

1 participant