-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Check usage of C#9 Function Pointers #279
Comments
In theory yes. It use another IL opcode that calls the method instead of a virtual call to the Invoke() method behind. However in practice I wonder if the JIT can eliminate these virtual call to Invoke() and call the method directly. |
My main quuestion what should I call with the pointers or |
You could replace all delegate If the It is an decent optimization, though you'd have to bench it to see the performance difference. If you can eliminate the embedding and invocation of a delegate it is generally a big win compared to e.g. arithmetic and tail call optimizations. |
@TYoungSL Great.
Yes, but it is hard to do generally. So you need to have a fitting scenario for this. And I did not yet work with such. |
I'll give it a shot. The use case I have we workaround by generating a dynamic static method with The function pointer is constant but the arguments change, we have to create stubs for any new static delegates / function pointers we want a fast We expand some delegate calls using It might make more sense to translate some delegate For managed |
I don't know, but could C#9 function pointers help to get more perfomance?
https://docs.microsoft.com/de-de/dotnet/csharp/language-reference/proposals/csharp-9.0/function-pointers
The text was updated successfully, but these errors were encountered: