dotnet / dotnet/macios

Optimize generated code

Open
#16,675 0 comments 0 reactions 0 assignees View on GitHub
app-size enhancement generator good first issue performance
Dominant language
C#
Stars
2.9k
Forks
576
Avg merge
2d 12h
Merged PRs (30d)
123

Description

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

Example:

```cs
[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 (error, false);
Foundation.NSData retval = del ( Runtime.GetNSObject (reply), ref __xamarin_pref1);
error = __xamarin_pref1 is null ? IntPtr.Zero : __xamarin_pref1.Handle;
return retval.GetHandle ();
}
```

* `Runtime.GetINativeObject` 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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.