Skip to content

Conversation

@Therzok
Copy link
Contributor

@Therzok Therzok commented May 30, 2017

the AbstractRecommendationService does a filter for which symbols should be included. Given this is called from ShouldIncludeSymbol, with this change we gain:

  1. Fewer iterations, as an Attribute is a type declaration, so GetMembers -> GetTypeMembers should give us fewer items to work with
  2. One less lambda capture by unrolling the foreach loop.

Customer scenario

https://gist.github.com/Therzok/4a168d452c6dcd5cd9ac0ee9cf25ae0e

The stacktrace above details how these issues were found.

Risk

Risk is low. IsAttribute() can only be true on type members.

Performance impact

Improves performance

Is this a regression from a previous update?

No.

Root cause analysis:

How did we miss it? What tests are we adding to guard against it in the future?

¯_(ツ)_/¯, not a functionality change, but an optimization.

How was the bug found?

Profiling VSfM.

Copy link
Member

@Pilchie Pilchie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Therzok!

Tagging @MattGertz for approval to help out Xamarin Studio perf.

@MattGertz
Copy link
Contributor

Approved & thanks!

Copy link
Contributor

@dpoeschl dpoeschl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code is good, just style/comments feedback.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: curly braces around return true;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: blank line between close curly brace and return false;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If getting rid of the lambda is important, then a comment to prevent someone from putting it back might be nice.

@Therzok
Copy link
Contributor Author

Therzok commented May 30, 2017

Fixed comments.

@dpoeschl
Copy link
Contributor

dpoeschl commented May 30, 2017

retest perf_correctness_prtest
https://ci.dot.net/job/dotnet_roslyn/job/master/job/perf_correctness_prtest/6813/
Corrupted NuGet cache issue. Tagging @jaredpar just in case this is useful.

@dpoeschl
Copy link
Contributor

dpoeschl commented May 30, 2017

retest windows_release_unit64_prtest please
https://ci.dot.net/job/dotnet_roslyn/job/master/job/windows_release_unit64_prtest/6892/artifact/Binaries/Release/UnitTests/EditorServicesTest2/xUnitResults/Roslyn.Services.Editor2.UnitTests.dll.out.log
The System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain. problem

@Therzok
Copy link
Contributor Author

Therzok commented Jun 3, 2017

I can't see why windows_eta_open_prtest failed, I get a 404:

HTTP ERROR 404

Problem accessing /job/Private/job/dotnet_roslyn-internal/job/master/job/windows_eta_open_prtest/6896/. Reason:

    Not Found

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"var type"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is reviewing an outdated commit

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's only one commit to review :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be "var type" or "var namedType"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhhhhh, I see.

@Therzok
Copy link
Contributor Author

Therzok commented Jun 3, 2017

Fixed!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no space between method cal and open paren :)

@Pilchie
Copy link
Member

Pilchie commented Jun 3, 2017

retest windows_debug_unit64_prtest please

@Pilchie
Copy link
Member

Pilchie commented Jun 3, 2017

Appears to have hit #19911

@Pilchie
Copy link
Member

Pilchie commented Jun 3, 2017

retest windows_release_vs-integration_prtest please

@Pilchie
Copy link
Member

Pilchie commented Jun 3, 2017

Appears to have hit #19816

@Pilchie
Copy link
Member

Pilchie commented Jun 3, 2017

retest windows_debug_vs-integration_prtest please

@Pilchie
Copy link
Member

Pilchie commented Jun 3, 2017

https://ci.dot.net/job/dotnet_roslyn/job/master/job/windows_debug_vs-integration_prtest/5098/ hit a deadlock in integration tests in the project system:

Main thread call-stack looks like the below. @srivatsn or @davkean have you seen this before?

>	ntdll.dll!_NtWaitForMultipleObjects@20�()	Unknown
 	KERNELBASE.dll!WaitForMultipleObjectsEx(unsigned long nCount, void * const * lpHandles, int bWaitAll, unsigned long dwMilliseconds, int bAlertable) Line 1551	C
 	KERNELBASE.dll!WaitForMultipleObjects(unsigned long nCount, void * const * lpHandles, int bWaitAll, unsigned long dwMilliseconds) Line 1403	C
 	Microsoft.VisualStudio.Threading.ni.dll!69143812()	Unknown
 	[Frames below may be incorrect and/or missing, native debugger attempting to walk managed call stack]	
 	Microsoft.VisualStudio.Threading.ni.dll!69143812()	Unknown
 	[Managed to Native Transition]	
 	Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.NoMessagePumpSyncContext.Wait(System.IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) Line 65	C#
 	mscorlib.dll!System.Threading.SynchronizationContext.InvokeWaitMethodHelper(System.Threading.SynchronizationContext syncContext, System.IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) Line 349	C#
 	[Native to Managed Transition]	
 	mscorlib.ni.dll!71a9a507()	Unknown
 	[Managed to Native Transition]	
 	mscorlib.dll!System.Threading.Monitor.Wait(object obj, int millisecondsTimeout, bool exitContext) Line 203	C#
 	mscorlib.dll!System.Threading.Monitor.Wait(object obj, int millisecondsTimeout) Line 213	C#
 	mscorlib.dll!System.Threading.ManualResetEventSlim.Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) Line 645	C#
 	mscorlib.dll!System.Threading.Tasks.Task.SpinThenBlockingWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) Line 3327	C#
 	mscorlib.dll!System.Threading.Tasks.Task.InternalWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) Line 3259	C#
 	mscorlib.dll!System.Threading.Tasks.Task.Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) Line 3167	C#
 	mscorlib.dll!System.Threading.Tasks.Task.Wait(System.TimeSpan timeout) Line 3083	C#
 	Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.WaitSynchronouslyCore(System.Threading.Tasks.Task task) Line 313	C#
 	Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.WaitSynchronously(System.Threading.Tasks.Task task) Line 290	C#
 	Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread() Line 841	C#
 	Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTask<Microsoft.VisualStudio.ProjectSystem.VS.HResult>.CompleteOnCurrentThread() Line 88	C#
 	Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.Run<Microsoft.VisualStudio.ProjectSystem.VS.HResult>(System.Func<System.Threading.Tasks.Task<Microsoft.VisualStudio.ProjectSystem.VS.HResult>> asyncMethod, Microsoft.VisualStudio.Threading.JoinableTaskCreationOptions creationOptions) Line 459	C#
 	Microsoft.VisualStudio.ProjectSystem.Implementation.dll!Microsoft.VisualStudio.ProjectSystem.ProjectMultiThreadedService.ExecuteSynchronously<Microsoft.VisualStudio.ProjectSystem.VS.HResult>(System.Func<System.Threading.Tasks.Task<Microsoft.VisualStudio.ProjectSystem.VS.HResult>> asyncAction) Line 139	C#
 	Microsoft.VisualStudio.ProjectSystem.VS.Implementation.dll!Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.HrInvoke.AnonymousMethod__0() Line 3738	C#
 	Microsoft.VisualStudio.ProjectSystem.VS.dll!Microsoft.VisualStudio.ProjectSystem.VS.HResult.Invoke(System.Func<Microsoft.VisualStudio.ProjectSystem.VS.HResult> action, System.IServiceProvider vsShellServiceProvider, Microsoft.VisualStudio.ProjectSystem.IProjectFaultHandlerService projectFaultHandlerService, Microsoft.VisualStudio.ProjectSystem.UnconfiguredProject project) Line 313	C#
 	Microsoft.VisualStudio.ProjectSystem.VS.Implementation.dll!Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.HrInvoke(System.Func<System.Threading.Tasks.Task<Microsoft.VisualStudio.ProjectSystem.VS.HResult>> asyncAction, bool registerProjectFaultHandlerService) Line 3735	C#
 	Microsoft.VisualStudio.ProjectSystem.VS.Implementation.dll!Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.Close() Line 1230	C#
 	Microsoft.VisualStudio.ProjectSystem.VS.Implementation.dll!Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNodeWrapper.Close() Line 545	C#
 	[Native to Managed Transition]	
 	msenv.dll!CProject::Close(int fRemoveProjectDir) Line 615	C++
 	msenv.dll!CSolution::RemoveProjectByCProject(CProject * pProject, int fUnloadProject, int nUnloadReasonID, unsigned long dwUnloadStatus) Line 22347	C++
 	msenv.dll!CSolution::RemoveProjectByHierarchy(IVsHierarchy * pHierarchy, int fUnloadProject) Line 22305	C++
 	msenv.dll!CSolution::CloseSolutionElement(unsigned long grfCloseOpts, IVsHierarchy * pHier, unsigned long docCookie) Line 6179	C++
 	msenv.dll!CSolution::ClearProjectsInternal(bool fSkipNested, std::set<CProject *,std::less<CProject *>,std::allocator<CProject *> > & projectsAlreadyClosed) Line 12892	C++
 	msenv.dll!CSolution::Clear(bool bClearProjects) Line 12665	C++
 	msenv.dll!CSolution::Close(int fDoSave, int fSaveAll, int fUpdateMRU) Line 18612	C++
 	msenv.dll!CVSolution::Close::__l2::<lambda>() Line 781	C++
 	msenv.dll!VsSupportErrorInfoSafeInvoke<HRESULT <lambda>(void) >(CVSolution::Close::__l2::HRESULT <lambda>(void) pfnFunctionImpl) Line 74	C++
 	msenv.dll!CVSolution::Close(short SaveFirst) Line 784	C++
 	rpcrt4.dll!_Invoke@12() Line 98	Unknown
 	rpcrt4.dll!NdrStubCall2(void * pThis, void * pChannel, _RPC_MESSAGE * pRpcMsg, unsigned long * pdwStubPhase) Line 1455	C++
 	combase.dll!CStdStubBuffer_Invoke(IRpcStubBuffer * This, tagRPCOLEMESSAGE * prpcmsg, IRpcChannelBuffer * pRpcChannelBuffer) Line 1449	C++
 	oleaut32.dll!CUnivStubWrapper::Invoke(tagRPCOLEMESSAGE * pMsg, IRpcChannelBuffer * pChnl) Line 615	C++
 	[Inline Frame] combase.dll!InvokeStubWithExceptionPolicyAndTracing::__l6::<lambda_1ba7c1521bf8e7d0ebd8f0b3c0295667>::operator()() Line 1824	C++
 	combase.dll!ObjectMethodExceptionHandlingAction<<lambda_1ba7c1521bf8e7d0ebd8f0b3c0295667> >(InvokeStubWithExceptionPolicyAndTracing::__l6::<lambda_1ba7c1521bf8e7d0ebd8f0b3c0295667> action, ObjectMethodExceptionHandlingInfo * pExceptionHandlingInfo, ExceptionHandlingResult * pExceptionHandlingResult, void *) Line 91	C++
 	[Inline Frame] combase.dll!InvokeStubWithExceptionPolicyAndTracing(IRpcStubBuffer * pMsg, tagRPCOLEMESSAGE *) Line 1822	C++
 	combase.dll!DefaultStubInvoke(bool bIsAsyncBeginMethod, IServerCall * pServerCall, IRpcChannelBuffer * pChannel, IRpcStubBuffer * pStub, unsigned long * pdwFault) Line 1891	C++
 	combase.dll!ServerCall::ContextInvoke(tagRPCOLEMESSAGE * pMessage, IRpcStubBuffer * pStub, CServerChannel * pChannel, tagIPIDEntry * pIPIDEntry, unsigned long * pdwFault) Line 1541	C++
 	combase.dll!AppInvoke(ServerCall * pServerCall, CServerChannel * pChannel, IRpcStubBuffer * pStub, void * pv, void * pStubBuffer, tagIPIDEntry * pIPIDEntry, WireLocalThis * pLocalb) Line 1604	C++
 	combase.dll!ComInvokeWithLockAndIPID(ServerCall * pServerCall, tagIPIDEntry * pIPIDEntry, bool * pbCallerResponsibleForRequestMessageCleanup) Line 2722	C++
 	combase.dll!ThreadWndProc(HWND__ * window, unsigned int message, unsigned int wparam, long params) Line 734	C++
 	user32.dll!__InternalCallWinProc@20�()	Unknown
 	user32.dll!UserCallWinProcCheckWow()	Unknown
 	user32.dll!DispatchMessageWorker()	Unknown
 	user32.dll!_DispatchMessageW@4�()	Unknown
 	[Inline Frame] combase.dll!CCliModalLoop::MyDispatchMessage(tagMSG *) Line 3148	C++
 	combase.dll!CCliModalLoop::PeekRPCAndDDEMessage() Line 2796	C++
 	combase.dll!CCliModalLoop::FindMessage(unsigned long dwStatus) Line 2867	C++
 	combase.dll!CCliModalLoop::HandleWakeForMsg() Line 2484	C++
 	combase.dll!CCliModalLoop::BlockFn(void * * ahEvent, unsigned long cEvents, unsigned long * lpdwSignaled) Line 2396	C++
 	combase.dll!ClassicSTAThreadWaitForHandles(unsigned long dwFlags, unsigned long dwTimeout, unsigned long cHandles, void * * pHandles, unsigned long * pdwIndex) Line 53	C++
 	combase.dll!CoWaitForMultipleHandles(unsigned long dwFlags, unsigned long dwTimeout, unsigned long cHandles, void * * pHandles, unsigned long * lpdwindex) Line 123	C++
 	vslog.dll!663714f6()	Unknown
 	[Managed to Native Transition]	
 	mscorlib.dll!System.Lazy<uint>.LazyInitValue() Line 386	C#
 	mscorlib.dll!System.Lazy<uint>.Value.get() Line 339	C#
 	Microsoft.VisualStudio.LanguageServices.dll!Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.FileChangeTracker.EnsureSubscription()	Unknown
 	Microsoft.VisualStudio.LanguageServices.dll!Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.VisualStudioMetadataReference.CurrentSnapshot.get()	Unknown
 	Microsoft.VisualStudio.LanguageServices.dll!Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.AbstractProject.AddMetadataReferenceCore(Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.VisualStudioMetadataReference reference)	Unknown
 	Microsoft.VisualStudio.LanguageServices.dll!Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.AbstractProject.AddMetadataReferenceAndTryConvertingToProjectReferenceIfPossible(string filePath, Microsoft.CodeAnalysis.MetadataReferenceProperties properties)	Unknown
 	Microsoft.VisualStudio.LanguageServices.Implementation.dll!Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.CPS.CPSProject.AddMetadataReference.AnonymousMethod__0()	Unknown
 	Microsoft.VisualStudio.LanguageServices.Implementation.dll!Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.CPS.CPSProject.ExecuteForegroundAction(System.Action action)	Unknown
 	Microsoft.VisualStudio.LanguageServices.Implementation.dll!Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.CPS.CPSProject.AddMetadataReference(string referencePath, Microsoft.CodeAnalysis.MetadataReferenceProperties properties)	Unknown
 	Microsoft.VisualStudio.ProjectSystem.Managed.dll!Microsoft.VisualStudio.ProjectSystem.LanguageServices.Handlers.MetadataReferenceItemHandler.Handle(Microsoft.VisualStudio.ProjectSystem.LanguageServices.BuildOptions added, Microsoft.VisualStudio.ProjectSystem.LanguageServices.BuildOptions removed, Microsoft.VisualStudio.LanguageServices.ProjectSystem.IWorkspaceProjectContext context, bool isActiveContext) Line 37	C#
 	Microsoft.VisualStudio.ProjectSystem.Managed.dll!Microsoft.VisualStudio.ProjectSystem.LanguageServices.Handlers.CommandLineItemHandler.ProcessItems(Microsoft.VisualStudio.ProjectSystem.IProjectChangeDescription projectChange, Microsoft.VisualStudio.LanguageServices.ProjectSystem.IWorkspaceProjectContext context, bool isActiveContext) Line 80	C#
 	Microsoft.VisualStudio.ProjectSystem.Managed.dll!Microsoft.VisualStudio.ProjectSystem.LanguageServices.Handlers.CommandLineItemHandler.Handle(Microsoft.VisualStudio.ProjectSystem.IProjectChangeDescription projectChange, Microsoft.VisualStudio.LanguageServices.ProjectSystem.IWorkspaceProjectContext context, bool isActiveContext) Line 55	C#
 	Microsoft.VisualStudio.ProjectSystem.Managed.dll!Microsoft.VisualStudio.ProjectSystem.LanguageServices.LanguageServiceHost.HandleAsync.AnonymousMethod__2() Line 310	C#
 	user32.dll!__InternalCallWinProc@20�()	Unknown
 	user32.dll!UserCallWinProcCheckWow()	Unknown
 	user32.dll!DispatchMessageWorker()	Unknown
 	user32.dll!_DispatchMessageW@4�()	Unknown
 	msenv.dll!MainMessageLoop::ProcessMessage(IMsoStdComponentMgr * pstdcm, IVsWindowManager * pIVsWindowManager, tagMSG & msg) Line 1857	C++
 	msenv.dll!CMsoCMHandler::EnvironmentMsgLoop() Line 450	C++
 	msenv.dll!CMsoCMHandler::FPushMessageLoop(unsigned long uReason) Line 358	C++
 	msenv.dll!SCM::FPushMessageLoop(SCMI * pscmi, unsigned long uReason, void * pvLoopData) Line 2262	C++
 	msenv.dll!SCM_MsoCompMgr::FPushMessageLoop(unsigned long dwComponentID, unsigned long uReason, void * pvLoopData) Line 2998	C++
 	msenv.dll!CMsoComponent::PushMsgLoop(unsigned long msgloop) Line 705	C++
 	msenv.dll!VStudioMainLogged() Line 1366	C++
 	msenv.dll!VStudioMain(MAINPARAM * pMainParam) Line 1595	C++
 	devenv.exe!util_CallVsMain(MAINPARAM * pMainParam, int * piRes) Line 1142	C++
 	devenv.exe!CDevEnvAppId::Run(wchar_t * wszCmdLine, int nCmdShow) Line 909	C++
 	devenv.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * __formal, char * lpCmdLine, int nCmdShow) Line 71	C++
 	[Inline Frame] devenv.exe!invoke_main() Line 94	C++
 	devenv.exe!__scrt_common_main_seh() Line 259	C++
 	kernel32.dll!@BaseThreadInitThunk@12�()	Unknown
 	ntdll.dll!__RtlUserThreadStart()	Unknown
 	ntdll.dll!__RtlUserThreadStart@8�()	Unknown
 	[Resuming Async Method]	
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(object stateMachine) Line 1090	C#
 	mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 954	C#
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 902	C#
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() Line 1070	C#
 	Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.SingleExecuteProtector.TryExecute() Line 1128	C#
 	Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.SingleExecuteProtector..cctor.AnonymousMethod__20_0(object state) Line 955	C#
 	WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Line 111	C#
 	WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Line 37	C#
 	WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl() Line 583	C#
 	WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(object state) Line 528	C#
 	WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(object obj) Line 235	C#
 	mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 954	C#
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 902	C#
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Line 891	C#
 	WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Line 185	C#
 	WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke() Line 441	C#
 	WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue() Line 2251	C#
 	WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Line 2504	C#
 	WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Line 345	C#
 	WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) Line 494	C#
 	WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Line 104	C#
 	WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Line 37	C#
 	WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) Line 1445	C#
 	WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Line 398	C#
 	[Native to Managed Transition]	
 	[Async Call]	
 	Microsoft.VisualStudio.ProjectSystem.Managed.dll!Microsoft.VisualStudio.ProjectSystem.LanguageServices.LanguageServiceHost.ExecuteWithinLockAsync.AnonymousMethod__0() Line 159	C#
 	[Async Call]	
 	Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTask.JoinAsync(System.Threading.CancellationToken cancellationToken) Line 519	C#
 	[Async Call]	
 	Microsoft.VisualStudio.ProjectSystem.Managed.dll!Microsoft.VisualStudio.ProjectSystem.LanguageServices.LanguageServiceHost.HandleAsync(Microsoft.VisualStudio.ProjectSystem.IProjectVersionedValue<Microsoft.VisualStudio.ProjectSystem.IProjectSubscriptionUpdate> update, Microsoft.VisualStudio.ProjectSystem.LanguageServices.RuleHandlerType handlerType) Line 286	C#
 	[Async Call]	
 	Microsoft.VisualStudio.ProjectSystem.Managed.dll!Microsoft.VisualStudio.ProjectSystem.LanguageServices.LanguageServiceHost.OnProjectChangedCoreAsync.AnonymousMethod__0() Line 112	C#
 	[Async Call]	
 	Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTask.JoinAsync(System.Threading.CancellationToken cancellationToken) Line 519	C#
 	Microsoft.VisualStudio.ProjectSystem.Implementation.dll!Microsoft.VisualStudio.ProjectSystem.ProjectAsynchronousTasksServiceBase.DrainTaskQueueAsync(Microsoft.VisualStudio.ProjectSystem.ProjectCriticalOperation operation, bool drainCurrentQueueOnly, bool throwExceptions, System.Threading.CancellationToken cancellationToken) Line 288	C#
 	[Async Call]	
 	Microsoft.VisualStudio.ProjectSystem.Managed.dll!Microsoft.VisualStudio.ProjectSystem.LanguageServices.LanguageServiceHost.OnProjectChangedCoreAsync(Microsoft.VisualStudio.ProjectSystem.IProjectVersionedValue<Microsoft.VisualStudio.ProjectSystem.IProjectSubscriptionUpdate> e, Microsoft.VisualStudio.ProjectSystem.LanguageServices.RuleHandlerType handlerType) Line 110	C#
 	[Async Call]	
 	Microsoft.VisualStudio.ProjectSystem.VS.Implementation.dll!Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.Close.AnonymousMethod__441_0() Line 1236	C#

@Pilchie
Copy link
Member

Pilchie commented Jun 4, 2017

Hit Roslyn.VisualStudio.IntegrationTests.CSharp.CSharpWinForms.ChangeControlProperty [FAIL].

@Pilchie
Copy link
Member

Pilchie commented Jun 4, 2017

retest windows_release_vs-integration_prtest please

@Therzok
Copy link
Contributor Author

Therzok commented Jun 4, 2017

Fixed last styling issue.

@davkean
Copy link
Member

davkean commented Jun 5, 2017

Not seen that before - I've filed dotnet/project-system#2377. @Pilchie Can you grab that dump and put it on a share? It will take me ~1 day to upload it to redmond.

@Pilchie
Copy link
Member

Pilchie commented Jun 5, 2017

retest windows_release_vs-integration_prtest please

@Pilchie
Copy link
Member

Pilchie commented Jun 5, 2017

Hit #15497, but for integration tests?

@Pilchie
Copy link
Member

Pilchie commented Jun 5, 2017

@Therzok: Unfortunately, we've missed the deadline to get fixes like this into 15.3 without significant customer impact. Are you okay with this going into the 15.6?

@Therzok
Copy link
Contributor Author

Therzok commented Jun 5, 2017

As long as there will be nuget roslyn releases in the meantime, we can get those into VSfM easily.

@Pilchie
Copy link
Member

Pilchie commented Jun 5, 2017

@Therzok There will be on MyGet, but there won't be on NuGet.org for a while.

@Pilchie Pilchie changed the base branch from master to dev15.6 June 6, 2017 16:33
@Pilchie
Copy link
Member

Pilchie commented Jun 6, 2017

@dotnet/roslyn-infrastructure @jimmy9988 - I just changed the target branch for this, and now it's brining 100 extra commits. Have we not been merging master into dev15.6?

@Pilchie
Copy link
Member

Pilchie commented Jun 7, 2017

Tried a close/open to get the PR to drop the already merged commits, but that didn't work. @dotnet/roslyn-infrastructure Do you know what the right approach is here?

@jasonmalinowski
Copy link
Member

@Pilchie Amend your HEAD commit and force-push. As long as you do a non-fast-forward push GitHub recomputes the effective commits.

@Pilchie
Copy link
Member

Pilchie commented Jun 7, 2017

@Therzok - is that something you can do?

@Pilchie
Copy link
Member

Pilchie commented Jun 7, 2017

Actually @jasonmalinowski - does it even matter? The commit has already be reviewed, and GitHub says it's a clean merge. Should we just hit merge?

@jaredpar
Copy link
Member

jaredpar commented Jun 7, 2017

Should we just hit merge?

I'd personally prefer not. Seems worth it to fix the PR so that it's a human readable merge. As constructed have no idea what is being merged here.

For example: PR as is has compiler changes. Pretty sure this didn't change compiler but how can I tell by looking at this?

the AbstractRecommendationService does a filter for which symbols should be included. Given this is called from ShouldIncludeSymbol, with this change we gain:
1. Fewer iterations, as an Attribute is a type declaration, so GetMembers -> GetTypeMembers should give us fewer items to work with
2. One less lambda capture by unrolling the foreach loop.
@Pilchie
Copy link
Member

Pilchie commented Jun 8, 2017

Okay - I rebased and pushed (and tweaked the space between method name and open paren :)

Will merge once Jenkins is done.

@Pilchie
Copy link
Member

Pilchie commented Jun 9, 2017

@CyrusNajmabadi any update on #20106?

@Pilchie
Copy link
Member

Pilchie commented Jun 9, 2017

retest windows_release_unit64_prtest please

@Pilchie Pilchie merged commit 63e8844 into dotnet:dev15.6 Jun 9, 2017
@Therzok Therzok deleted the patch-2 branch June 10, 2017 10:06
@Neme12
Copy link
Contributor

Neme12 commented Mar 21, 2018

@Therzok Hi, sorry to bother you. It seems like this PR introduced a recent regression in completion that was reported here: #25589. Basically, as I understand this, you made 3 changes to remove the performance bottleneck in this PR:

  1. remove the lambda and replace it with a foreach loop
  2. remove the call to GetMembers() inside each type and replace it with GetTypeMember()
  3. removing the walk over namespaces and thus basically removing the recursion altogether except for nested types

By reading through the comments here, it seems like 3) was actually unintentional. Could you please confirm/clarify this? Thanks!

As it stands, I made a PR #25622 that would put number 3) back while still keeping the first 2 optimizations (essentially calling GetMembers() on namespaces but only calling GetTypeMembers() on types to not go through all members inside each and every type), but there's a concern here. This, though likely unintentional, might have been the actual change that removed the performance problem - we don't know. But it is also possible that the performance problem would have been equally removed by the other optimizations you did and my PR would work well. Could you please weigh in on this / share some thoughts / potentially help us figure out which change might have had the crucial impact on performance and whether walking over all namespaces (until we find the first attribute) might be acceptable? Thanks a lot.

@Therzok
Copy link
Contributor Author

Therzok commented Mar 21, 2018

Hey @Neme12. Ooops, sorry for this! I didn't intend to remove namespace recursion in the code. My test case did not have nested namespaces, but did have nested types (it's code-style enforced, so I missed this).

1 problem was that a lot of enumerator allocations were done, causing memory pressure while the code was running (we do everything in-process, so reducing allocations in hot paths is beneficial).

The other problem, which increased performance, was not iterating all non-type members of a type.

So, this was an unintentional change, #25622 LGTM!

@Neme12
Copy link
Contributor

Neme12 commented Mar 21, 2018

@Therzok Thanks, that's what I was thinking. That's good news but I think the team would still like some proof that the PR wouldn't degrade performance again. @CyrusNajmabadi said he's definitely concerned about walking all namespaces and would like to be cautious here.

@Neme12
Copy link
Contributor

Neme12 commented Mar 21, 2018

Ooops, sorry for this! I didn't intend to remove namespace recursion in the code. My test case did not have nested namespaces, but did have nested types (it's code-style enforced, so I missed this).

That's a failure in the original test suite that this wasn't covered.

@Therzok
Copy link
Contributor Author

Therzok commented Mar 21, 2018

Moved discussion to the PR, I commented some other possible performance improvement that could be gained in GetAllTypes.

@Therzok
Copy link
Contributor Author

Therzok commented Mar 21, 2018

Not all namespaces will be walked, especially when GetAllTypes is lazily evaluated.

@Neme12
Copy link
Contributor

Neme12 commented Mar 21, 2018

@Therzok Yes, that is correct. But walking through all namespaces would still be the worst case scenario and really depends on what sort of project/library you're working on. Some people could definitely hit this. I think we'd like to make sure that even in the worst case scenario of walking all namespaces, this is not a perf problem.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants