-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Slower IDispatch calls in compare to .NET Framework. #98788
Comments
Presence of this method in the profile means that the module metadata was switched to a writeable mode that is much slower. The read-only version of the same method is optimized using binary search runtime/src/coreclr/md/runtime/mdinternalro.cpp Lines 1933 to 1962 in 9da5359
You can try setting a breakpoint at |
Hi @jkotas. Thank you for prompt response. Ok, I put breakpoint in place you mentioned, then I did step out in debugger and inspect this->m_identity->m_path.m_asStr. It looks like call stack for assembly in question is here:
0x00007ffc`f406dd6f is this code:
So my understanding is following:
I can confirm that if I remove If I understand code correctly |
This is known issue #90563. The fix is being worked on in #93902. cc @hoyosjs The issue is triggered by old Windows-style (aka full or non-portable .pdbs) being used to provide file names and line numbers in the formatted stacktrace. Any one of the following is going to avoid the issue:
|
Tagging subscribers to this area: @tommcdon Issue DetailsWe are porting our application from .NET Framework to .NET 6 and we have system of plugins that using Interface in C# declared like this:
During the performance tests of one of our plugin I found that it is slower than the same version in .NET Framework. After checking in PerfView I found this callstack in .NET Framework:
And total time for And this callstack for .NET 6
And total time for Basically there is no call for If I got it right the source of problem is here:
I put breakpoint there and My question am I correct about this? If yes, is it possible to mitigate it somehow? I checked .NET 8 source code and it looks mostly the same. I cannot verify it on .NET 8 because one of 3rd party assemblies we use is not compatible with .NET 8 yet. Thank you.
|
Hi @jkotas I checked and there are no .pdb files, but that assembly itself compiled for .NET Framework and loaded into .NET 6 runtime. Can this create this issue? I can recompile it using |
Ah ok, maybe deleting the file is not sufficient. Yes, recompiling with |
Hi @jkotas It looks like we will be able to remove But if you interested, we changed how we build out product and created build with portable PDB and problem is still there. From what I see call stack is the same but variable From my understanding there is still call to |
If Maybe these is another path that triggers the RO->RW conversion in your app, that does not involve |
@jkotas It looks like it is problem in .NET 6 code. In that version call to |
For reference, this was fixed in #68990 |
Thank you for your help. I think issue is solved and I will close it. I hope we can migrate to .NET 8 soon :) |
We are porting our application from .NET Framework to .NET 6 and we have system of plugins that using
IDispatch
to call the native code.Interface in C# declared like this:
During the performance tests of one of our plugin I found that it is slower than the same version in .NET Framework. After checking in PerfView I found this callstack in .NET Framework:
And total time for
clr!CLRToCOMLateBoundWorker
is 26.123 seconds There are a few more functions thatclr!CLRToCOMLateBoundWorker
calls that they are less than 500ms each.And this callstack for .NET 6
And total time for
clr!CLRToCOMLateBoundWorker
is 28.290 secondsBasically there is no call for
coreclr!Module::GetPropertyInfoForMethodDef
in .NET Framework and this call consumes in .NET 6about 7.509 seconds out of 28.290.
If I got it right the source of problem is here:
I put breakpoint there and
ridMax
is 0x33F and it looks like eachIDispatch
call will loop 831 times in this function and found nothing because there are no properties in this assembly. Just in case I put breakpoint in body of that IF and it never stops there.My question am I correct about this? If yes, is it possible to mitigate it somehow?
I checked .NET 8 source code and it looks mostly the same. I cannot verify it on .NET 8 because one of 3rd party assemblies we use is not compatible with .NET 8 yet.
Thank you.
The text was updated successfully, but these errors were encountered: