Perf prob: what causes tabline to trigger the call to the format function?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Perf prob: what causes tabline to trigger the call to the format function?

Eric Arnold-3
I've sorta isolated a performance problem I'm having with my
TabLineSet.vim script.  If I set the string to include a %(func()}
string (which in this case, addeds a hour/min/sec string), and do
something to update a buffer in a tab with multiple windows, then
*every* keystroke from then on calls the "tabline" function to refresh
the tabline.

Normally, the trigger to re-evaluate the tabline string is only called
on certain things, like switching windows, setting a buffer to
'modified'/'nomodified', etc.  Since my script is doing a lot of stuff
to create the format string, it is counting on being called sparsely,
and when it is called for every keystroke, it's an unacceptable
performance drag.

Certain operations, like hitting "undo" to reset the buffer to
"unmodified", or switching to another window and back, will stop the
per-keystroke tabline re-eval.

So, I'm looking for some hints as to why the re-eval might be getting
called for every keystroke.  The doc.s don't detail the behavior, so
I'm shooting in the dark at the moment.
Reply | Threaded
Open this post in threaded view
|

Re: Perf prob: what causes tabline to trigger the call to the format function?

Bram Moolenaar

Eric Arnold wrote:

> I've sorta isolated a performance problem I'm having with my
> TabLineSet.vim script.  If I set the string to include a %(func()}
> string (which in this case, addeds a hour/min/sec string), and do
> something to update a buffer in a tab with multiple windows, then
> *every* keystroke from then on calls the "tabline" function to refresh
> the tabline.
>
> Normally, the trigger to re-evaluate the tabline string is only called
> on certain things, like switching windows, setting a buffer to
> 'modified'/'nomodified', etc.  Since my script is doing a lot of stuff
> to create the format string, it is counting on being called sparsely,
> and when it is called for every keystroke, it's an unacceptable
> performance drag.
>
> Certain operations, like hitting "undo" to reset the buffer to
> "unmodified", or switching to another window and back, will stop the
> per-keystroke tabline re-eval.
>
> So, I'm looking for some hints as to why the re-eval might be getting
> called for every keystroke.  The doc.s don't detail the behavior, so
> I'm shooting in the dark at the moment.

This can only happen when your 'tabline' option does something that
would normally require the tab pages line to be redrawn.

I can probably prevent the problem by resetting the flag for redrawing
the tabline after evaluating 'tabline'.

--
hundred-and-one symptoms of being an internet addict:
92. It takes you two hours to check all 14 of your mailboxes.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://www.ICCF.nl         ///