On Monday, June 10, 2013 8:47:35 PM UTC-5, Hiroshi Shirosaki wrote:
>
> 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\
Isn't that first bit much too complicated? Am I missing something, or is this:
\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(RUBY_...
equivalent to this:
\%([^.]\.\_s*\)\@<!\%(RUBY_...
?
Changes:
1. remove \|::, because that part will only match when the first part already
matched
2. Strip out most of the \@<! because they are expensive and the whole first
part is zero-width anyway
3. Ditch the \zs because the \@<! is zero-width already
I don't know what exactly this is supposed to match, and there are no matches
for the existing pattern in the test file, so I can't test for regression.
But even without byte limits, just this change cuts the search time for this
particular pattern quite drastically.
before:
TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN
0.011726 107 0 0.000389 0.000110 rubyPredefinedConstant
\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(RUBY_VERSION\|STDE
0.010879 107 0 0.000370 0.000102 rubyPredefinedConstant
\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(DATA\|FALSE\|NIL\|
0.009818 107 0 0.000324 0.000092 rubyPredefinedConstant
\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(MatchingData\|ARGF
0.001947 125 19 0.000069 0.000016 rubyConstant
\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)
0.001522 110 3 0.000098 0.000014 rubyConditionalExpression
\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:low
0.001450 107 0 0.000062 0.000014 rubySymbol
[]})\"':]\@<!\h\w*[!?]\=:\s\@=
0.001417 107 0 0.000044 0.000013 rubyKeywordAsMethod
\%(\%(\.\@<!\.\)\|::\)\_s*\%(alias\|and\|begin\|break\
after:
TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN
0.006246 251 52 0.000208 0.000025 rubyConstant
\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)
0.005748 203 0 0.000133 0.000028 rubyPredefinedConstant
\%([^.]\.\_s*\)\@<!\%(RUBY_VERSION\|STDERR\|STDIN\|STD
0.005279 203 0 0.002737 0.000026 rubySymbol
[]})\"':]\@<!:\%(\^\|\~\|<<\|<=>\|<=\|<\|===\|==\|=\~\
0.005090 203 0 0.000125 0.000025 rubyPredefinedConstant
\%([^.]\.\_s*\)\@<!\%(DATA\|FALSE\|NIL\|RUBY_PLATFORM\
0.004919 203 0 0.000125 0.000024 rubySymbol
[]})\"':]\@<!\h\w*[!?]\=:\s\@=
0.004752 203 0 0.000129 0.000023 rubySymbol
\%([{(,]\_s*\)\@<=\l\w*[!?]\=::\@!
0.004428 203 0 0.000114 0.000022 rubyPredefinedConstant
\%([^.]\.\_s*\)\@<!\%(MatchingData\|ARGF\|ARGV\|ENV\)\
--
--
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.