<div dir="ltr">Hi,<div><br></div><div>Thanks for the analysis.<br><div class="gmail_extra"><br><br><div class="gmail_quote">On 29 September 2013 11:26, Pavel Roschin <span dir="ltr"><<a href="mailto:roshin@scriptumplus.ru" target="_blank">roshin@scriptumplus.ru</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Geany is very fast of course:) But we could make it faster<br>
<br>
I use excellent runtime profiler named crxprof. It helped me to find one<br>
bottleneck in geany's starting logic:<br>
<br>
main (100.0% | 0.0% self)<br>
 \_ configuration_open_files (55.5% | 0.0% self)<br>
 | \_ document_open_file_full (55.4% | 0.0% self)<br>
 |   \_ editor_goto_pos (29.7% | 0.0% self)<br>
 |     \_ sci_goto_pos (29.5% | 0.0% self)<br>
 |       \_ ScintillaGTK::WndProc (29.5% | 0.0% self)<br>
 |         \_ Editor::WndProc (29.5% | 0.0% self)<br>
 |           \_ Editor::EnsureLineVisible (29.5% | 0.0% self)<br>
 |             \_ Editor::WrapLines (29.5% | 0.0% self)<br>
 |               \_ Editor::WrapOneLine (21.2% | 0.0% self)<br>
 |                 \_ Editor::LayoutLine (20.3% | 0.4% self)<br>
 |                   \_ PositionCache::MeasureWidths (19.0% | 0.3% self)<br>
 |                     \_ SurfaceImpl::MeasureWidths (18.7% | 0.4% self)<br>
 |                       \_ pango_layout_get_iter (16.1% | 1.1% self)<br>
 |                         \_ pango_itemize_with_base_dir (5.7% | 0.8% self)<br>
<br>
As you see, editor_goto_pos takes 1/3 of _loading_ time!<br>
<br></blockquote><div><br></div><div>IIUC what you are seeing here is Scintilla laying out the window for the first time, not just the goto.  That still will be done if the editor_goto_pos is not called, just from a delayed idle callback IIUC.  If its in the order of 3 seconds then I'm not sure delaying it is really going to improve the user experience (even though it moves the action out of the function you are measuring :)</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
But it shouldn't be called at least if position if 0, so adding simple<br>
optimization will improve loading speed:<br>
<br>
GeanyDocument *document_open_file_full(..)<br>
.............<br>
        if(pos)<br>
        {<br>
                /* set the cursor position according to pos,<br>
        cl_options.goto_line and cl_options.goto_column */ pos =<br>
        set_cursor_position(doc->editor, pos); /* now bring the file in front */<br>
                editor_goto_pos(doc->editor, pos, FALSE);<br>
        }<br>
<br></blockquote><div><br></div><div>This now ignores the cl_options settings since it doesn't call set_cursor_position() any more :(</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Not best solution but it works for me:<br>
<br>
Loading time before optimization: 8.952s<br>
Loading time after optimization: 5.799s<br>
<br>
Much better, isn't?<br>
<br>
Other proposals about loading speed:<br>
1) Skip unnecessary operations for EACH document because actually user will see<br>
only LAST loaded document. Other operations could be delayed.<br></blockquote><div><br></div><div>Possibly, but you have to ensure that the actions actually happen at some point.  Sure you don't have to layout the hidden windows immediately, but does that mean that the first time you swap to a hidden file is slow? </div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2) Put tag manager in separate thread and parse tags not inside GUI thread<br>
because it's really slow. Adding mutex for tag manager shouldn't be hard.<br></blockquote><div><br></div><div>It is difficult, it has been discussed many times, but neither Geany, nor Ctags, nor tagmanager, nor GTK are thread safe and it would take a major re-design to use them from multiple threads.</div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
3) Maybe, delay loading of all files? Load and show only last file, load others<br>
only when they need to be displayed. This will allow to have 1000-s of tabs<br>
without a pain. I think people who work on huge projects will understand me.<br>
<br></blockquote><div><br></div><div>Basically the same problem as number 1), plus the difficulty of maintaining which tabs are loaded and laid out.</div><div><br></div><div>Sad as I am to say it, but maybe those with 1000s of tabs need a different editor/ide, Geany's target is "small lightweight and simple" and it is important that it maintains its focus on that.</div>
<div><br></div><div>Not that any of these ideas are impossible, just not as easy as they seem.</div><div><br></div><div>Cheers</div><div>Lex</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

--<br>
Best regards,<br>
Pavel Roschin aka RPG<br>
_______________________________________________<br>
Devel mailing list<br>
<a href="mailto:Devel@lists.geany.org">Devel@lists.geany.org</a><br>
<a href="https://lists.geany.org/cgi-bin/mailman/listinfo/devel" target="_blank">https://lists.geany.org/cgi-bin/mailman/listinfo/devel</a><br>
</blockquote></div><br></div></div></div>