vim-patch:9.0.1464: strace filetype detection is expensive

Problem:    Strace filetype detection is expensive.
Solution:   Match with a cheap pattern first. (Federico Mengozzi,
            closes vim/vim#12220)

6e5a9f9482

Co-authored-by: Federico Mengozzi <19249682+fedemengo@users.noreply.github.com>
(cherry picked from commit 9808866d57)
This commit is contained in:
Christian Clason
2023-04-18 12:01:51 +02:00
committed by github-actions[bot]
parent 4d30f34a37
commit 17bdaeb79e
2 changed files with 15 additions and 2 deletions

View File

@@ -1550,8 +1550,15 @@ local patterns_text = {
['^SNNS pattern definition file'] = 'snnspat',
['^SNNS result file'] = 'snnsres',
['^%%.-[Vv]irata'] = { 'virata', { start_lnum = 1, end_lnum = 5 } },
['[0-9:%.]* *execve%('] = 'strace',
['^__libc_start_main'] = 'strace',
function(lines)
if
-- inaccurate fast match first, then use accurate slow match
(lines[1]:find('execve%(') and lines[1]:find('^[0-9:%.]* *execve%('))
or lines[1]:find('^__libc_start_main')
then
return 'strace'
end
end,
-- VSE JCL
['^\\* $$ JOB\\>'] = { 'vsejcl', { vim_regex = true } },
['^// *JOB\\>'] = { 'vsejcl', { vim_regex = true } },