Bram Moolenaar <[email protected]> wrote:

> Mike Williams wrote:
>
>> > [...]
>
> Thanks for looking into performance.  Please redo your measurements with
> all the recent patches.  Depending on the pattern they can make a large
> impact.


Here are profiling results using Linux perf tools, with
 Vim-7.3.1144 and its runtime files, compiled with
 -O0 to avoid inline, using regexpengine=0 and
 the same grammar.xml as earlier in this discussion.

 $ perf record vim -c ':$' -c :redraw -c :q grammar.xml
 $ perf report

 19.31%     vim  vim                    [.] nfa_regmatch
 16.92%     vim  vim                    [.] addstate
  7.00%     vim  vim                    [.] syn_current_attr
  4.26%     vim  libc-2.15.so           [.] __memmove_ssse3_back
  4.21%     vim  vim                    [.] utfc_ptr2len
  3.80%     vim  libc-2.15.so           [.] _int_malloc
  3.62%     vim  vim                    [.] copy_sub
  2.82%     vim  libc-2.15.so           [.] _int_free
  2.77%     vim  vim                    [.] in_id_list
  2.08%     vim  vim                    [.] nfa_regexec_both
  1.57%     vim  vim                    [.] utf_ptr2char
  1.53%     vim  vim                    [.] ga_init
  1.44%     vim  libc-2.15.so           [.] malloc
  1.33%     vim  vim                    [.] ml_get_buf
  1.21%     vim  vim                    [.] vim_strchr
  1.14%     vim  vim                    [.] sha256_process
  0.99%     vim  vim                    [.] lalloc
  0.94%     vim  vim                    [.] vim_iswordp_buf
  0.92%     vim  vim                    [.] vim_free
  0.67%     vim  libc-2.15.so           [.] __strncmp_sse42
  0.65%     vim  vim                    [.] recursive_regmatch
  0.65%     vim  vim                    [.] ga_init2
  0.63%     vim  vim                    [.] do_autocmd_event
  0.61%     vim  vim                    [.] unref_extmatch
  0.57%     vim  vim                    [.] do_one_cmd
  0.55%     vim  vim                    [.] check_state_ends
  0.53%     vim  libc-2.15.so           [.] free
  0.52%     vim  vim                    [.] hash_hash
  0.49%     vim  vim                    [.] hash_lookup
  0.48%     vim  libc-2.15.so           [.] __memset_sse2

The same when compiling Vim with -O3  (not much different):

 20.70%     vim  vim                [.] nfa_regmatch
 18.29%     vim  vim                [.] addstate
  7.07%     vim  vim                [.] syn_current_attr.constprop.26
  5.44%     vim  vim                [.] utfc_ptr2len
  5.18%     vim  libc-2.15.so       [.] _int_free
  5.10%     vim  libc-2.15.so       [.] _int_malloc
  3.30%     vim  libc-2.15.so       [.] __memmove_ssse3_back
  3.04%     vim  libc-2.15.so       [.] malloc
  1.86%     vim  vim                [.] in_id_list
  1.34%     vim  vim                [.] utf_ptr2char
  1.20%     vim  vim                [.] sha256_process
  1.19%     vim  vim                [.] ml_get_buf
  1.10%     vim  vim                [.] lalloc
  1.00%     vim  vim                [.] vim_iswordp_buf
  0.99%     vim  vim                [.] vim_strchr
  0.98%     vim  libc-2.15.so       [.] __strncmp_sse42
  0.88%     vim  vim                [.] do_one_cmd
  0.87%     vim  vim                [.] recursive_regmatch
  0.85%     vim  vim                [.] do_autocmd_event
  0.77%     vim  vim                [.] nfa_regexec_both
  0.64%     vim  vim                [.] check_state_ends
  0.53%     vim  vim                [.] nfa_regtry
  0.51%     vim  libc-2.15.so       [.] free
  0.47%     vim  libc-2.15.so       [.] __memset_sse2
  0.47%     vim  vim                [.] unref_extmatch
  0.47%     vim  vim                [.] cleanup_subexpr.part.8
  0.45%     vim  vim                [.] find_name_end
  0.45%     vim  vim                [.] ga_init2
  0.41%     vim  vim                [.] hash_lookup
  0.36%     vim  vim                [.] vim_free


Since most of the time is in nfa_regmatch and addstate,
I ran gcov to see what lines gets most executed most
times, but I did not find anything interesting.

More interesting, is the output of...

:syntime on
CTLRL-L
CTRL-L
:syntime report

  TOTAL      COUNT  MATCH   SLOWEST     AVERAGE   NAME               PATTERN
  3.234792   47684  0       0.002802    0.000068  xmlSyncDT
\_.\(<!DOCTYPE\)\@=
  0.802073   106321 94581   0.000316    0.000008  XmlEndTag
</[^ /!?<>"']\+>
  0.541822   117989 106361   0.000360   0.000005  xmlError           [<&]
  0.425396   92519  56350   0.000103    0.000005  xmlTag
<[^ /!?<>"']\@=
  0.403861   47757  0       0.000319    0.000008  xmlDocType         <!DOCTYPE
  0.394247   47757  6       0.000315    0.000008  xmlProcessing      <?
  0.391976   47757  0       0.000314    0.000008  xmlCdata           <!\[CDATA\[
  0.391330   47761  110     0.000319    0.000008  xmlComment         <!
  0.231504   107562 107562   0.000062   0.000002  xmlTag             >
  0.057517   47787  62      0.000054    0.000001  xmlEntity          &[^; \t]*;
  0.001245   78     70      0.000040    0.000016  XmlAttrib
[-'"<]\@2<!\<[a-zA-Z:_][-.0-9a-zA-Z0-9:_]*\>\(['">]\@!\|$\)
  0.001004   9      0       0.000426    0.000112  xmlNamespace
\(<\|</\)\@2<=[^ /!?<>"':]\+[:]\@=
  0.000768   318    278     0.000012    0.000002  xmlComment         >
  0.000762   398    106     0.000008    0.000002  xmlCommentPart     --
  0.000628   4      2       0.000299    0.000157  XmlTagName
[<]\@2<=[^ /!?<>"']\+
  0.000508   212    106     0.000008    0.000002  xmlCommentError    [^><!]
  0.000276   212    106     0.000003    0.000001  xmlCommentStart    <!
  0.000254   106    106     0.000008    0.000002  xmlCommentPart     --
  0.000234   60     60      0.000005    0.000004  xmlProcessing      ?>
  0.000211   43     32      0.000010    0.000005  xmlAttribPunct     [:.]
  0.000137   63     46      0.000010    0.000002  xmlEqual           =
  0.000098   50     44      0.000003    0.000002  xmlString          "
  0.000053   22     22      0.000004    0.000002  xmlString          "
  0.000045   20     20      0.000003    0.000002  xmlEntityPunct     [&.;]
  0.000023   8      0       0.000004    0.000003  xmlString          '

  6.880764   712497

Clearly the top regexp (xmlSyncDT) stands out even
if its executed less times than other regexps.

Regards
Dominique

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


Raspunde prin e-mail lui