See
this thread for the the exact problem.
libfab has a workspace that opens about 280 files at start.
With trunk on linux it took about 2:56 minutes, on windows (virtual w2k-machine) it took only 0:32.
The wxAui-test-branch needs "only" 1:10 min, it has improvements to the utf-8 conversion and some general tweaks when loading files, especially large files.
The utf-8 changes are already discussed here:
http://forums.codeblocks.org/index.php/topic,10159.0.html.
I did some more research and found another cause for the slow performance (I still don't know, why it's os much slower on windows, than on linux, but that's another thing).
In
editcolourset.cpp in function
Apply we apply the default style for a given language to all styles up to
wxSCI_STYLE_MAX (255).
I moved
SetStyleBits, so we can get the amount of stylebits needed by the actual lexer, and therefore the maximum amount of really used styles (default is 32).
That speeds up the loading time for the test-workspace for about 30 seconds (it needs about 0:40 min now), so it comes near the windows loading time.
The patch below is not the patch I posted in the other thread (it was a little late, when I worked on it last night).
I think it should not break any lexer, because it determines the amount of used styles after
SetStyleBits.
It would be really nice, if other devs (and of course all our users) can have alook at this patch, because together with the other tweaks in the wxAui-test branch fileloading on linux is much, much faster than with trunk.
But I'm not a lexer-guru, so I am not 100% sure, if it can not break anything.
Index: codeblocks.aui/src/sdk/editorcolourset.cpp
===================================================================
--- codeblocks.aui/src/sdk/editorcolourset.cpp (Revision 5593)
+++ codeblocks.aui/src/sdk/editorcolourset.cpp (Arbeitskopie)
@@ -430,11 +430,15 @@
if (lang == HL_NONE)
return;
- // first load the default colours to all styles (ignoring some built-in styles)
+ // first load the default colours to all styles used by the actual lexer (ignoring some built-in styles)
OptionColour* defaults = GetOptionByName(lang, _("Default"));
+ OptionSet& mset = m_Sets[lang];
+ control->SetLexer(mset.m_Lexers);
+ control->SetStyleBits(control->GetStyleBitsNeeded());
if (defaults)
{
- for (int i = 0; i < wxSCI_STYLE_MAX; ++i)
+ int countStyles = 1 << control->GetStyleBits();
+ for (int i = 0; i < countStyles; ++i)
{
if (i < 33 || i > 39)
DoApplyStyle(control, i, defaults);
@@ -445,7 +449,6 @@
// this makes sure it stays the correct colour
control->StyleSetForeground(wxSCI_STYLE_LINENUMBER, wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
- OptionSet& mset = m_Sets[lang];
for (unsigned int i = 0; i < mset.m_Colours.GetCount(); ++i)
{
OptionColour* opt = mset.m_Colours.Item(i);
@@ -486,8 +489,6 @@
// }
}
}
- control->SetLexer(mset.m_Lexers);
- control->SetStyleBits(control->GetStyleBitsNeeded());
for (int i = 0; i <= wxSCI_KEYWORDSET_MAX; ++i)
{
control->SetKeyWords(i, mset.m_Keywords[i]);
Any suggestions and arguments against or for this patch are welcome.