Tracy client slow startup due to Symbol resolution pre-caching
The Trarcy profilee starts up very slowly in my case, around 2-3 minutes, however after this the applications continues to run normally.
A quick glance with a profiler (VerySleepy in this case) shows that almost all this time is taken up by the FindFirstFileW WinAPI function.
I have attached the typical call stack for this function in the application.

Removing Tracy from the build fixes the issue and the application starts up instantly as expected. If breakpoints are added, it is clear that this hang is caused at static initialization time since the breakpoint in main will not get hit until the application starts normally.
Pausing the application in a debugger would seem to be a more sensible approach for finding out what is happening.
Yes, however like I said this occurs during static initialization time, before the main function starts executing, and I do not know the code for Tracy well enough to know where to debug it, a breakpoint in main would only be hit after the initial few minutes of startup. If you can tell me where I should start to debug Tracy I'll see if I can find what is slowing down.
You can just pause the execution in MSVC and look where the threads are stopped.
Same here. Our application is defining TRACY_DBGHELP_LOCK and is locked due to TracyCallstack.cpp is holding the lock. I tried unlocking earlier , and then protecting again the SymLoadModuleEx call, but it was still slow.
Commenting the SymLoadModuleEx and unlocking early seems to do the trick.
diff -r b979ac45de4f tracy/public/client/TracyCallstack.cpp
--- a/tracy/public/client/TracyCallstack.cpp Wed Nov 23 10:52:45 2022 +0100
+++ b/tracy/public/client/TracyCallstack.cpp Wed Nov 23 12:03:10 2022 +0100
@@ -157,6 +157,10 @@
SymInitialize( GetCurrentProcess(), nullptr, true );
SymSetOptions( SYMOPT_LOAD_LINES );
+#ifdef TRACY_DBGHELP_LOCK
+ DBGHELP_UNLOCK;
+#endif
+
DWORD needed;
LPVOID dev[4096];
if( EnumDeviceDrivers( dev, sizeof(dev), &needed ) != 0 )
@@ -193,7 +197,9 @@
path = full;
}
- SymLoadModuleEx( GetCurrentProcess(), nullptr, path, nullptr, (DWORD64)dev[i], 0, nullptr, 0 );
+ // DBGHELP_LOCK
+ // SymLoadModuleEx( GetCurrentProcess(), nullptr, path, nullptr, (DWORD64)dev[i], 0, nullptr, 0 );
+ // DBGHELP_UNLOCK
const auto psz = strlen( path );
auto pptr = (char*)tracy_malloc_fast( psz+1 );
@@ -245,7 +251,7 @@
}
#ifdef TRACY_DBGHELP_LOCK
- DBGHELP_UNLOCK;
+ // DBGHELP_UNLOCK;
#endif
}