Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 309 by [email protected]: Expensive (non-limited) patterns with syntax/diff.vim
https://code.google.com/p/vim/issues/detail?id=309

TEST CASE:
1. wget https://gist.githubusercontent.com/blueyed/b098ff662b2963621ec0/raw/a6f5a88f43c3f55a48bf89ddcad08c86ed2e67c9/test.diff
2. vim -u NONE -N test.diff
3. :syntax on

There are a lot of expensive / non-limited regexp patterns in syntax/diff.vim,
mostly for the translations, e.g.:

    " he
    syn match diffOnly  "^.*-ב קר אצמנ .*"

With long diff lines, e.g. from a minified javascript or json file, this
becomes very expensive and Vim takes a very long time to apply the syntax
highlighting.

Patterns that start with `^.*` should probably get changed to not match what
the generic matches are meant to match (e.g. diffRemoved).
This might require to use syntax regions / contained or something similar?
(because all `syn match` statements are being applied (IIRC), and not just the
first/last one)

For starters, something like `^[^+-]` could be used, but then it would not
handle filenames starting with the characters.

The absolutely worst behaving pattern is the following, and might indicate a
problem with the regexp engine, which should optimize it according to the
anchoring at the end:

    " he
    syn match diffIsA   "^.* .*-ל .* .* תוושהל ןתינ אל$"

Apart from that, I think it might be a good idea to just use "LANGUAGE=C diff"
(or something similar to get the non-translated messages) to get the diff.


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
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