[Geany-Devel] Geany performance

Matthew Brush mbrush at xxxxx
Sun Sep 29 08:30:08 UTC 2013


On 13-09-28 06:26 PM, Pavel Roschin 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% self)
>
> As you see, editor_goto_pos takes 1/3 of _loading_ time!
>
> 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(..)
> .............
> 	if(pos)
> 	{
> 		/* 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);
> 	}
>
> Not best solution but it works for me:
>
> Loading time before optimization: 8.952s
> Loading time after optimization: 5.799s
>
> Much better, isn't?
>

It is. If I understand correctly the original reason for this is because 
when you set the scintilla buffer (at least as it goes currently), it 
pushes the cursor to the end of the inserted text, and so it needs to be 
pushed back to the start by default (if no other position is stored or 
specified). Please excuse if I'm mistaken here.

Cheers,
Matthew Brush



More information about the Devel mailing list