Bram Moolenaar wrote:
>>
>> So does the patch look like a good one to you? Or will I just live with
>> it here locally? :)
>
> The patch looks OK to me. The big question is: how much performance do
> we gain?
>
> There is also another regexp improvement underway, this was part of the
> Google summer of code. It would be nice if we have a performance
> measurement mechanism, so that the regexp stuff can be tuned. A Vim
> script would be best, so that it can be run everywhere. Perhaps using
> some of the syntax highlighting, since that uses regexp a lot and
> provides a real-world situation. Since the actual display updating is
> not what we want to measure, using the synID() function might work.
> Combined with ":syn sync fromstart".
>
OK, so I'll need to prepare some numbers.
For now some historical background. I started this performance
investigation due to a pathological performance degradation on my VIM
script for coloring rgb.txt file (the file comes in the root of Vim
runtime file tree). I color it so that each line is colored with RGB it
represents. The script is attached.
It creates a big number of highlight groups with short simple matches.
It was light-fast on VIM 6.3 and it became redrawing slo-o-o-w on VIM 7
(after os-stack-based-regexp-stack to heap-based stack change). This is
why I investigated it. So I wouldn't say that it's improvement - it's
actually back to performance of 6.3. Now I need to prove you that it's
actually "back". OK, will do :-)
--
Alexei Alexandrov
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
function! Byte2Hex(byte)
let hex_chars = '0123456789ABCDEF'
return hex_chars[a:byte / 16] . hex_chars[a:byte % 16]
endfunction
function! RGBHighlight()
let line_idx = 1
let num_lines = line("$")
while line_idx <= num_lines
let line = getline(line_idx)
let line_idx = line_idx + 1
if line =~ '^\s*\d\+\s\+\d\+\s\+\d\+\s\+.*$'
let r = substitute(line,
'^\s*\(\d\+\)\s\+\(\d\+\)\s\+\(\d\+\)\s\+.*$', '\1', "")
let g = substitute(line,
'^\s*\(\d\+\)\s\+\(\d\+\)\s\+\(\d\+\)\s\+.*$', '\2', "")
let b = substitute(line,
'^\s*\(\d\+\)\s\+\(\d\+\)\s\+\(\d\+\)\s\+.*$', '\3', "")
let hlcolor = Byte2Hex(r) . Byte2Hex(g) . Byte2Hex(b)
let hlname = 'RGB' . hlcolor
if !hlexists(hlname)
exec "highlight " . hlname . " guifg=#" . hlcolor
exec "syntax match " . hlname . ' /^\s*' . r. '\s\+' . g .
'\s\+' . b . '\s\+.*$/'
endif
endif
endwhile
endfunction
call RGBHighlight()