[Geany-Devel] Geany performance
elextr at xxxxx
Sun Sep 29 02:34:39 UTC 2013
Thanks for the analysis.
On 29 September 2013 11:26, Pavel Roschin <roshin at scriptumplus.ru> wrote:
> Geany is very fast of course:) But we could make it faster
> I use excellent runtime profiler named crxprof. It helped me to find one
> bottleneck in geany's starting logic:
> main (100.0% | 0.0% self)
> \_ configuration_open_files (55.5% | 0.0% self)
> | \_ document_open_file_full (55.4% | 0.0% self)
> | \_ editor_goto_pos (29.7% | 0.0% self)
> | \_ sci_goto_pos (29.5% | 0.0% self)
> | \_ ScintillaGTK::WndProc (29.5% | 0.0% self)
> | \_ Editor::WndProc (29.5% | 0.0% self)
> | \_ Editor::EnsureLineVisible (29.5% | 0.0% self)
> | \_ Editor::WrapLines (29.5% | 0.0% self)
> | \_ Editor::WrapOneLine (21.2% | 0.0% self)
> | \_ Editor::LayoutLine (20.3% | 0.4% self)
> | \_ PositionCache::MeasureWidths (19.0% | 0.3% self)
> | \_ SurfaceImpl::MeasureWidths (18.7% | 0.4% self)
> | \_ pango_layout_get_iter (16.1% | 1.1% self)
> | \_ pango_itemize_with_base_dir (5.7% | 0.8%
> As you see, editor_goto_pos takes 1/3 of _loading_ time!
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 :)
> But it shouldn't be called at least if position if 0, so adding simple
> optimization will improve loading speed:
> GeanyDocument *document_open_file_full(..)
> /* set the cursor position according to pos,
> cl_options.goto_line and cl_options.goto_column */ pos =
> set_cursor_position(doc->editor, pos); /* now bring the file in
> front */
> editor_goto_pos(doc->editor, pos, FALSE);
This now ignores the cl_options settings since it doesn't call
set_cursor_position() any more :(
> Not best solution but it works for me:
> Loading time before optimization: 8.952s
> Loading time after optimization: 5.799s
> Much better, isn't?
> Other proposals about loading speed:
> 1) Skip unnecessary operations for EACH document because actually user
> will see
> only LAST loaded document. Other operations could be delayed.
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?
> 2) Put tag manager in separate thread and parse tags not inside GUI thread
> because it's really slow. Adding mutex for tag manager shouldn't be hard.
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.
> 3) Maybe, delay loading of all files? Load and show only last file, load
> only when they need to be displayed. This will allow to have 1000-s of tabs
> without a pain. I think people who work on huge projects will understand
Basically the same problem as number 1), plus the difficulty of maintaining
which tabs are loaded and laid out.
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.
Not that any of these ideas are impossible, just not as easy as they seem.
> Best regards,
> Pavel Roschin aka RPG
> Devel mailing list
> Devel at lists.geany.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Devel