[Geany-Devel] Geany performance

Pavel Roschin roshin at xxxxx
Sun Sep 29 01:26:36 UTC 2013


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?

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.
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.
3) Maybe, delay loading of all files? Load and show only last file, load others
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 me.

--
Best regards,
Pavel Roschin aka RPG


More information about the Devel mailing list