Wednesday, June 21, 2017

Re: measure time betwween two normal commands

Great, thanks!  For help and method.


Le 21 juin 2017 23:10, "Bram Moolenaar" <Bram@moolenaar.net> a écrit :

Ni Va wrote:

> > > Since some days, I notice that time to reach next occurence of a
> > > search  take time.
> > >
> > > search foo
> > >
> > > n(ext) >>> here I see 1 or 2 seconds to jump to the occurence.
> > >
> > > How can I find the plugin, measure by profile before and after n command?
> >
> > I added more places to check for a timeout.  Esp. check if resetting
> > 'hlsearch' helps.
> >
> > To measure time:
> >
> >     let start = reltime()
> >     normal n
> >     echomsg 'elapsed: ' . string(reltimefloat(reltime(start)))
> >
> > If you have a specfic pattern and text on which it is slow, please let
> > me know so that I can run the profiler with it.
> >
> > --
> > hundred-and-one symptoms of being an internet addict:
> > 52. You ask a plumber how much it would cost to replace the chair in front of
> >     your computer with a toilet.
> >
> >  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
> > ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> > \\\  an exciting new programming language -- http://www.Zimbu.org        ///
> >  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
>
> Hi Bram,
>
> No specific pattern, it can be "set", "let", "foo", "bar".
>
> Effectively, reltime can help me to measure time but how to proceed to find which plugin, ftdetect, ftplugin slows this command ?

First thing I would do is find out if it is the search (unlikely) or
something related to redrawing the window (most likely).  You can find
out by searching for something that's already visible (no redraw) and
something that's further away (requires a redraw).

For the redraw, it can be syntax highlighting, folding, etc.

But keep in mind I changed the way timeouts are done in the regexp code,
if this checks the current time too often it will add overhead.  I would
need an example to figure out the balance between not timing out soon
and checking too often.

--
"I simultaneously try to keep my head in the clouds and my feet on the
ground.  Sometimes it's a stretch, though."              -- Larry Wall

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: