User forums > Using Code::Blocks
Time used to open a file
MortenMacFly:
--- Quote from: mandrav on April 19, 2011, 08:01:42 pm ---The exact problem I 'm seeing is that it takes a *lot* of time (about a second each) to reopen each previously opened file while loading the project.
--- End quote ---
It may be related, just for the record: I experienced a different bad bug: If I open a WS with many projects (~15-20) and files are being opened due to the layout, sometimes CC freaks out and never stops parsing. This only happens if file were opened, but I didn't find a way to reproduce. There seems no logic behind.
However, (on second thoughts) as Jens said CC is disabled for him it may be a another issue... but still: it could be related. I've disabled the option to re-open files for exactly that issue, so I didn't realise the issue you mentioned.
(I've no access to C::B at the moment btw...)
Jenna:
One thing that speeds up loading of large files a lot is moving SetLanguage(HL_AUTO) from SetEditorStyleBeforeFileOpen to SetEditorStyleAfterFileOpen.
All measurements are made with a lot of debug statements in the code, that write to C::B's debug-log, that's one of the causes for the very long overall loading time.
For a 3.5 MB test cpp-file the load-time changes from 6.349 s to 1.654 s (74 % better).
Load-time of a web-project (all files opened) that contains mainly small php,js and css-files decreased from 40.614 ms to 36.501 ms (10 % better).
C::B project's load-time changes from 8 m 56.375 ms to 7 m 37.214 s (15 % better).
This change can decrease the loadtime depending on the filesizes a lot or at least a little bit, but it should not harm in any cases.
Any tests are welcome, to ensure there are no side-effects.
There are at least two other places where a little more time is needed:
Sending the cbEVT_EDITOR_ACTIVATED-event in void EditorManager::SetActiveEditor(EditorBase* ed) and the call to m_pControl->GotoPos(m_pProjectFile->editorPos) (and m_pControl2->GotoPos(m_pProjectFile->editorPos_2) if editor is in split-view) in void cbEditor::SetProjectFile(ProjectFile* project_file, bool preserve_modified) also take a resonable amount of time. The second is a call to a scintilla-function and therefore not so easy to change (without hacking scintilla).
The first only needs to be called if the editor is the topmost editor, but is called for every editor that gets opened via cbEditor* EditorManager::Open(LoaderBase* fileLdr, const wxString& filename, int /*pos*/, ProjectFile* data) at the moment.
MortenMacFly:
--- Quote from: jens on April 20, 2011, 12:41:59 am ---One thing that speeds up loading of large files a lot is moving SetLanguage(HL_AUTO) from SetEditorStyleBeforeFileOpen to SetEditorStyleAfterFileOpen.
--- End quote ---
Nice catch, Jens.
However, I recall that this call was moved to that place for some reason (fixing a bug) recently... Or am I wrong (I cannot consult SVN blame/log for the moment)?
In addition: Can you commit the instrumentation concerning measuring the times needed to SVN and making it "toggle-able" with a #define? I feel as if we'll need this again in the future... :)
Jenna:
--- Quote from: MortenMacFly on April 20, 2011, 08:17:55 am ---
--- Quote from: jens on April 20, 2011, 12:41:59 am ---One thing that speeds up loading of large files a lot is moving SetLanguage(HL_AUTO) from SetEditorStyleBeforeFileOpen to SetEditorStyleAfterFileOpen.
--- End quote ---
Nice catch, Jens.
However, I recall that this call was moved to that place for some reason (fixing a bug) recently... Or am I wrong (I cannot consult SVN blame/log for the moment)?
In addition: Can you commit the instrumentation concerning measuring the times needed to SVN and making it "toggle-able" with a #define? I feel as if we'll need this again in the future... :)
--- End quote ---
Parts of it are already in svn, the needed define is "fileload_measuring", but it does not cover all parts.
At the moment I use a much more finegrained debug-output, but that can not be committed, because it litters the sources with tons of ifdefs.
svn blame does not really work for some commits, because when remerging cc-branch wit trunk (or aui-branch I do not remember exactly) the sourcees have been copied instead of doing a real merge (that was broken as far as I know).
One major bottleneck was fixed two years ago:
http://forums.codeblocks.org/index.php/topic,10552.msg72360.html
If I remember correctly, I also did something with SetLanguage, but I do not recall exactly what it was, I will search the websvn to find if there is anything related.
oBFusCATed:
--- Quote from: jens on April 20, 2011, 09:08:06 am ---At the moment I use a much more finegrained debug-output, but that can not be committed, because it litters the sources with tons of ifdefs.
--- End quote ---
Why don't you add something like
--- Code: ---#ifdef CB_FILELOAD_MEASURING
CB_FILELOAD_PRINT printf
#else
#define CB_FILELOAD_PRINT(...)
#endif
--- End code ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version