2015-10-22 2:29 GMT+03:00 Radoslaw Burny <[email protected]>:

> To reply to the previous question about my measurements: I took one of the
> bigger files from my team's C++ codebase, and copied it 5 times. The result
> was 1.1 MB, 30 kLOC C++ file. Only the first search time was measured;
> vim-searchindex caches the results, so repeated search would be immediate.
> I did two types of experiments:
>
>    - searches for short and common words (so that many matches are hit),
>    e.g. "void" or identifiers widely used in the file. Number of matches was
>    up to 10k, depending on the pattern, and didn't affect the timing much. The
>    counting took 30ms.
>    - simple regex like a.*b.*( . This is something I would use on a
>    one-off basis if I don't remember exact method name; obviously, this only
>    exposes tiny part of complexity of regexes. In this case, number of matches
>    was 2k, and the result was 100ms.
>
> Christian, what results did you achieve? How does it scale with the number
> of lines & number of matches? If we could achieve a reasonably small
> timeout for files below 10kLOC and 1000 matches, this would already be a
> huge win (as I think it covers "normal" programming usage).
>

​I think that most problematic will be multi-line matches (e.g. something
like `^\S.*(\_[^)]*​\<foo,` to find functions which have “foo” argument
(example was not actually tested and depends on the coding style)). Also
huge slowdown will be present in case of using back and forward references
(especially with a new regexp engine), but this is less critical with the
existence of \zs and \ze which cover many use-cases.

Most my searches though are simple `\<word\>` or `word`, which are fast.



> One approach to limiting lag would be to have time-based "deadline" and
> just try to count the matches on the best-effort basis.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/vim/vim/issues/453#issuecomment-150053385>.
>
> --
> --
> You received this message from the "vim_dev" 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_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui