eBram Moolenaar wrote: > You can enable the profiler in the Makefile. The one using Gmon only > measures time per function though. I already know that addstate() is > taking most time. Need to try to reduce the number of calls.
Opening this xml file... http://svn.code.sf.net/p/languagetool/code/trunk/languagetool/languagetool-language-modules/fr/src/main/resources/org/languagetool/rules/fr/grammar.xml ... is slow (apparently because of folding in the vim modeline of the xml file). Here are the functions that take most time when profiling with the new engine (regexpengine=0) with gprof when running: $ vim -c ':$' -c :redraw -c :q grammar.xml Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls s/call s/call name 30.14 1.70 1.70 1686454 0.00 0.00 nfa_regmatch 28.01 3.28 1.58 19068887 0.00 0.00 addstate 5.32 3.58 0.30 2551778 0.00 0.00 syn_current_attr 4.08 3.81 0.23 19483875 0.00 0.00 utfc_ptr2len 3.37 4.00 0.19 21931117 0.00 0.00 copy_sub 3.01 4.17 0.17 2197962 0.00 0.00 in_id_list 1.42 4.25 0.08 38020 0.00 0.00 sha256_process 1.24 4.32 0.07 4784 0.00 0.00 do_autocmd_event 1.06 4.38 0.06 5059366 0.00 0.00 lalloc_clear 1.06 4.44 0.06 360025 0.00 0.00 nfa_regexec_both 0.89 4.49 0.05 15747906 0.00 0.00 utf_ptr2char 0.89 4.54 0.05 4264744 0.00 0.00 ga_init2 0.89 4.59 0.05 2939342 0.00 0.00 vim_iswordp_buf 0.89 4.64 0.05 3363 0.00 0.00 do_cmdline 0.71 4.68 0.04 5981436 0.00 0.00 ga_init 0.71 4.72 0.04 5302016 0.00 0.00 lalloc 0.71 4.76 0.04 1326429 0.00 0.00 recursive_regmatch 0.71 4.80 0.04 134442 0.00 0.00 eval7 0.71 4.84 0.04 85701 0.00 0.00 do_one_cmd 0.71 4.88 0.04 27947 0.00 0.00 modifier_len 0.71 4.92 0.04 1 0.04 0.75 readfile 0.53 4.95 0.03 1484193 0.00 0.00 check_state_ends 0.53 4.98 0.03 1440100 0.00 0.00 clear_sub 0.53 5.01 0.03 150048 0.00 0.00 vim_strchr 0.53 5.04 0.03 70326 0.00 0.00 find_command 0.53 5.07 0.03 24021 0.00 0.00 foldlevelMarker 0.35 5.09 0.02 5667058 0.00 0.00 unref_extmatch 0.35 5.11 0.02 5087240 0.00 0.00 ml_get_buf Main bottleneck functions nfa_regmatch() and addstate() are quite big so it's not simple to find obvious optimization from the profiling result. For comparison, here are the profiling reslts with the old engine (regexpengine=1): Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls s/call s/call name 20.30 0.81 0.81 2708411 0.00 0.00 regmatch 12.78 1.32 0.51 2551778 0.00 0.00 syn_current_attr 8.02 1.64 0.32 22460090 0.00 0.00 utfc_ptr2len 7.77 1.95 0.31 2155993 0.00 0.00 vim_strchr 5.01 2.15 0.20 11045415 0.00 0.00 regnext 4.26 2.32 0.17 2197962 0.00 0.00 in_id_list 3.26 2.45 0.13 360017 0.00 0.00 bt_regexec_both 1.75 2.52 0.07 38020 0.00 0.00 sha256_process 1.50 2.58 0.06 5667058 0.00 0.00 unref_extmatch 1.50 2.64 0.06 307735 0.00 0.00 hash_lookup 1.25 2.69 0.05 5111068 0.00 0.00 ml_get_buf 1.25 2.74 0.05 2939342 0.00 0.00 vim_iswordp_buf 1.25 2.79 0.05 2708411 0.00 0.00 regtry 1.25 2.84 0.05 2648033 0.00 0.00 regstack_pop 1.25 2.89 0.05 2648033 0.00 0.00 regstack_push 1.25 2.94 0.05 134442 0.00 0.00 eval7 1.00 2.98 0.04 2816427 0.00 0.00 ga_grow 1.00 3.02 0.04 307735 0.00 0.00 hash_hash 0.88 3.06 0.04 11427142 0.00 0.00 utf_ptr2char 0.88 3.09 0.04 4681275 0.00 0.00 syn_getcurline 0.75 3.12 0.03 2608546 0.00 0.00 ga_init 0.75 3.15 0.03 1999786 0.00 0.00 cstrchr 0.75 3.18 0.03 1484193 0.00 0.00 check_state_ends 0.75 3.21 0.03 1377844 0.00 0.00 reg_save 0.75 3.24 0.03 351732 0.00 0.00 cstrncmp 0.75 3.27 0.03 340806 0.00 0.00 syn_add_end_off 0.75 3.30 0.03 144035 0.00 0.00 check_keyword_id Loading the file and moving page by page of this xml file is faster with the old engine. However, near the long line 23745, moving the cursor is much faster with the new engine. So good and bad things with the new engine, which seems expected. 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.
