Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Pecan on April 23, 2012, 06:04:26 pm

Title: Patch to speed workspace loading/closing
Post by: Pecan on April 23, 2012, 06:04:26 pm
The following patch speeds loading and closing a workspace to about half (at least on my system).

FindTargetsDebugger() is rebuilding the debugger menu system for every activation of a project. It does not need to do this during opening and closing of a workspace since after the workspace is loaded, CB will activated the correct project anyway.

It does not need to do it at all during closing of a workspace. With the patch, closing the CB workspace changed from 7 to less than 1 second.

Code
Index: src/sdk/debuggermanager.cpp
===================================================================
--- src/sdk/debuggermanager.cpp (revision 7937)
+++ src/sdk/debuggermanager.cpp (working copy)
@@ -1146,7 +1146,10 @@
 }

 void DebuggerManager::FindTargetsDebugger()
-{
+{
+    if (Manager::Get()->GetProjectManager()->IsLoadingOrClosing())
+        return;
+
     m_activeDebugger = nullptr;
     m_menuHandler->SetActiveDebugger(nullptr);


svn build  rev 7937 (2012-04-23 04:29:22)   gcc 4.6.1 Windows/unicode - 32 bit
Title: Re: Patch to speed workspace loading/closing
Post by: oBFusCATed on April 23, 2012, 06:07:23 pm
Go on and commit it, we can always revert it, if it breaks something, but I doubt it will.
Title: Re: Patch to speed workspace loading/closing
Post by: Pecan on April 23, 2012, 06:12:08 pm
Sorry, but I cannot commit to CB. I don't have the credentials.

Title: Re: Patch to speed workspace loading/closing
Post by: oBFusCATed on April 23, 2012, 07:15:15 pm
OK, I'll commit it...
Title: Re: Patch to speed workspace loading/closing
Post by: oBFusCATed on April 23, 2012, 08:03:16 pm
In svn.
Title: Re: Patch to speed workspace loading/closing
Post by: MortenMacFly on April 24, 2012, 07:59:20 am
Sorry, but I cannot commit to CB. I don't have the credentials.
Why not? You should ask Yiannis to adjust that. I guess its an error...?!