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

RealProxy use is *dog slow* and impacts test run #2323

Closed
AArnott opened this issue Jun 16, 2021 · 1 comment
Closed

RealProxy use is *dog slow* and impacts test run #2323

AArnott opened this issue Jun 16, 2021 · 1 comment

Comments

@AArnott
Copy link
Contributor

AArnott commented Jun 16, 2021

In analyzing why my tests were running so slowly, I found that 25% of the CPU time in the test runner process was lost to using RealProxy:

Name Inc % Inc
mscorlib.ni!RealProxy.PrivateInvoke 25.1 19,157
+ mscorlib.ni!RemotingProxy.Invoke 25.0 19,032
|+ mscorlib.ni!RemotingProxy.InternalInvoke 24.8 18,942
||+ mscorlib.ni!RemotingProxy.CallProcessMessage 24.8 18,930
|||+ mscorlib.ni!SmuggledMethodCallMessage.SmuggleIfPossible 15.7 11,958
||||+ mscorlib.ni!System.Runtime.Remoting.Messaging.SmuggledMethodCallMessage..ctor(System.Runtime.Remoting.Messaging.IMethodCallMessage) 15.6 11,904
|||||+ mscorlib.ni!MessageSmuggler.FixupArgs 11.5 8,770
||||||+ mscorlib.ni!MessageSmuggler.FixupArg 11.4 8,730
|||||||+ mscorlib.ni!RemotingServices.MarshalInternal 11.4 8,663
||||||||+ mscorlib.ni!RemotingServices.GetOrCreateIdentity 11.2 8,569
|||||||||+ mscorlib.ni!IdentityHolder.FindOrCreateServerIdentity 11.2 8,552
||||||||||+ mscorlib.ni![COLD] System.Runtime.Remoting.IdentityHolder.SetIdentity(System.Runtime.Remoting.Identity, System.String, System.Runtime.Remoting.DuplicateIdentityOption) 10.6 8,047
|||||||||||+ clr!JIT_IsInstanceOfClass 9.8 7,440

Most of the time spent in RealProxy comes from the xunit test runner itself:

Name Inc % Inc
mscorlib.ni!RealProxy.PrivateInvoke 25.1 19,157
+ clr!CTPMethodTable__CallTargetHelper3 25.1 19,156
|+ clr!CallTargetWorker2 25.1 19,156
| + clr!??TransparentProxyStubWorker 25.1 19,156
|  + clr!TransparentProxyStub_CrossContext 25.1 19,156
|   + xunit.runner.utility.net452!OptimizedRemoteMessageSink.OnMessage 15.3 11,674

Can xunit switch from using RealProxy to something far more efficient?

Repro steps

git clone https://github.com/microsoft/CsWin32
cd CsWin32
git checkout 8c6685a6dacde60ec90b1699bb0fdf9d12207d50
Microsoft.Windows.CsWin32.sln

Run the InterestingAPIs class of tests in the net472 TFM, while collecting an ETL trace (I used PerfView)

Resulting ETL trace (use PerfView or VS to analyze).

@bradwilson
Copy link
Member

App Domains (and thus proxies) are completely removed from v3, so there's no work to be done here AFAICT.

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

No branches or pull requests

2 participants