On Monday, June 10, 2013 8:47:35 PM UTC-5, Hiroshi Shirosaki wrote: > Hi, > > I noticed slowness with the following file with Vim 7.3.1163 regexpengine=0. > > https://raw.github.com/rails/rails/v2.3.18/actionpack/lib/action_controller/session/abstract_store.rb > > rubyPredefinedConstant pattern looks much slower with this file. > > syntime result: > > :set re=0 > > TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN > 0.073358 187 0 0.001526 0.000392 rubyPredefinedConstant > \%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(RUBY_\%(VERSION\|RELEASE_DATE\|PLATFORM\|PATCHLEVEL\|REVISION\|DESCRIPTION\|COPYRIGHT\|ENGINE\ > 0.018682 187 0 0.000380 0.000100 rubyPredefinedConstant > \%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>\%(\s*(\)\@! > 0.013895 187 0 0.000315 0.000074 rubyPredefinedConstant > \%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>\%(\s*(\)\@! > 0.013364 187 0 0.000255 0.000071 rubyPredefinedConstant > \%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(DATA\|FALSE\|NIL\)\>\%(\s*(\)\@! > 0.002764 245 64 0.000046 0.000011 rubyConstant > \%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=\%(\s*(\)\@! > 0.002424 187 0 0.000065 0.000013 rubySymbol > []})\"':]\@<!\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:\s\@= > 0.001819 192 5 0.000068 0.000009 rubyConditionalExpression > \%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|unless\)\> > 0.001697 187 0 0.000033 0.000009 rubyKeywordAsMethod > \%(\%(\.\@<!\.\)\|::\)\_s*\%(undef\|unless\|until\|when\|while\|yield\|BEGIN\|END\|__FILE__\|__LINE__\)\> > > > :set re=1 > > TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN > 0.008567 187 0 0.000514 0.000046 rubySymbol > []})\"':]\@<!\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:\s\@= > 0.005828 187 0 0.000094 0.000031 rubyPredefinedConstant > \%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>\%(\s*(\)\@! > 0.005348 187 0 0.000089 0.000029 rubyPredefinedConstant > \%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>\%(\s*(\)\@! > 0.004913 187 0 0.000082 0.000026 rubyPredefinedConstant > \%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(DATA\|FALSE\|NIL\)\>\%(\s*(\)\@! > 0.003586 187 0 0.000059 0.000019 rubyPredefinedConstant > \%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(RUBY_\%(VERSION\|RELEASE_DATE\|PLATFORM\|PATCHLEVEL\|REVISION\|DESCRIPTION\|COPYRIGHT\|ENGINE\ > 0.002730 187 0 0.000079 0.000015 rubySymbol > [[:space:],{]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:\s\@= > 0.002398 187 0 0.000075 0.000013 rubySymbol > \%([{(,]\_s*\)\@<=\l\w*[!?]\=::\@! > 0.001528 245 64 0.000040 0.000006 rubyConstant > \%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=\%(\s*(\)\@! > 0.001289 189 2 0.000029 0.000007 rubyKeywordAsMethod > \%(\%(\.\@<!\.\)\|::\)\_s*\%(elsif\|end\|ensure\|false\|for\|if\|in\|module\|next\|nil\)\>
That pattern contains a few patterns using \@<! which can only match one or two characters before. They should probably be explicitly limited like \@2<!. I think performance of patterns like this is the reason the byte-limiting behavior was added. -- -- 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/groups/opt_out.
