[Geany-Devel] Geany performance

Lex Trotman elextr at xxxxx
Sun Sep 29 10:01:22 UTC 2013


On 29 September 2013 19:45, Pavel Roschin <rpg89 at post.ru> wrote:

> Shouldn't updateUI called only for _visible_ documents? Anyway it will
> when you
> click on tab and change document.
>

No it also does notifications, which doesn't depend on visibility.  It
shouldn't render if the document is not visible, but it still should do the
callbacks.  sci_goto_pos() is called in lots of places in Geany, not just
at load time, and probably lots more in plugins, missing notifications has
an unknown impact.



>
> Considering problem more deeper - actually bottleneck function is
> SCI_ENSUREVISIBLE, not exactly sci_goto_pos. Ok, there are many things to
> thinking about.
>

Well, the costly part is the rendering, which happens from a delayed GTK
idle callback inside scintilla.  As Matthew said when the text is inserted
into the buffer the cursor is at the end, getting it back to the start
before the rendering is important, the less of the text Scintilla renders
the better, and if the position is set at zero it *should* only render the
start of the text, not the whole file, which would happen if the position
was still at the end.

Cheers
Lex

PS please only reply to the list, not directly to people as well, thats how
stuff gets disconnected from the list.


> > On 29 September 2013 18:47, Pavel Roschin <rpg89 at post.ru> wrote:
> >
> > > > 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.
> > >
> > > Geany with my patch behaves normally without unnecessary goto_pos. But
> > > today
> > > I added more clear-looking patch that skips goto-ing if pos ==
> current_pos.
> > > Isn't? Try, it will take 2 minutes:
> > >
> > > void sci_goto_pos(ScintillaObject *sci, gint pos, gboolean unfold)
> > > {
> > >         if (unfold) SSM(sci, SCI_ENSUREVISIBLE, (uptr_t) SSM(sci,
> > >         SCI_LINEFROMPOSITION, (uptr_t) pos, 0), 0);
> > >         /* Do not goto if we are already here */
> > >         if(pos == sci_get_current_position(sci)) return;
> > >         SSM(sci, SCI_GOTOPOS, (uptr_t) pos, 0);
> > > }
> > >
> >
> > The problem with this is that by not calling the SSM(sci, SCI_GOTOPOS,
> > (uptr_t) pos, 0); you don't schedule an updateUI and you then don't get
> the
> > associated notifications.  I don't know what impacts that might have,
> > especially as plugins can depend on those notifications.
> >
> > I would be *very* wary changing the semantics of such low level functions
> > without great care, checking where they are used and all the side
> effects,
> > such as the notification callbacks.
> >
> > Cheers
> > Lex
> >
> >
> > >
> > > --
> > > Best regards,
> > > Pavel Roschin aka RPG
> > > _______________________________________________
> > > Devel mailing list
> > > Devel at lists.geany.org
> > > https://lists.geany.org/cgi-bin/mailman/listinfo/devel
> > >
>
>
>
>
> --
> Best regards,
> Pavel Roschin aka RPG
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20130929/fb38241e/attachment.html>


More information about the Devel mailing list