I'm trying to debug why executing the first po
is taking so long in a big application (around 4 million lines of code, almost all Swift).
The application is composed of a huge amount of static framework modules.
I've turned on logging with log enable dwarf all
, but there are no logs during most of the duration of the loading.
Using a profiler I can see that the heaviest stacktrace is the following during the loading:
Weight Self Weight Symbol Names
32.52 Gc 99,8% 683.56 Kc lldb_private::plugin::dwarf::SymbolFileDWARF::ParseCompileUnit(lldb_private::plugin::dwarf::DWARFCompileUnit&)
21.23 Gc 65,1% 7.99 Gc lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::GetCompileUnit(lldb_private::plugin::dwarf::SymbolFileDWARF*, lldb_private::plugin::dwarf::DWARFCompileUnit&)
5.06 Gc 0,0% 5.06 Gc lldb_private::plugin::dwarf::DebugMapModule::GetSymbolFile(bool, lldb_private::Stream*)
4.81 Gc 0,0% 4.81 Gc lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo(lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::CompileUnitInfo*)
3.36 Gc 0,0% 3.36 Gc lldb_private::plugin::dwarf::SymbolFileDWARF::GetPluginName()
2.65 Mc 0,0% 1.00 Mc lldb_private::SymbolFileCommon::GetNumCompileUnits()
1.65 Mc 0,0% 1.00 Mc lldb_private::SymbolFile::GetModuleMutex() const
650.48 Kc 0,0% 650.48 Kc lldb_private::ModuleChild::GetModule() const
6.65 Gc 20,4% 6.65 Gc lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo(lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::CompileUnitInfo*)
4.64 Gc 14,2% 4.64 Gc lldb_private::plugin::dwarf::DebugMapModule::GetSymbolFile(bool, lldb_private::Stream*)
1.00 Mc 0,0% 1.00 Mc lldb_private::plugin::dwarf::DWARFUnit::SetUserData(void*)
Executing swift-healthcheck
after the po
is executed does not contain any errors.
I would really appreciate some directions on how I could debug this further.
The goal would be to identify if there are any modules/compile units that take significantly longer to load the debug information for than the others.
Removing the modules one by one and checking the impact is not a feasible solution since that would require immense amount of time.