Karsten Hopp a99fff
To: vim_dev@googlegroups.com
Karsten Hopp a99fff
Subject: Patch 7.3.1131
Karsten Hopp a99fff
Fcc: outbox
Karsten Hopp a99fff
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp a99fff
Mime-Version: 1.0
Karsten Hopp a99fff
Content-Type: text/plain; charset=UTF-8
Karsten Hopp a99fff
Content-Transfer-Encoding: 8bit
Karsten Hopp a99fff
------------
Karsten Hopp a99fff
Karsten Hopp a99fff
Patch 7.3.1131
Karsten Hopp a99fff
Problem:    New regexp engine is a bit slow.
Karsten Hopp a99fff
Solution:   Do not clear the state list.  Don't copy syntax submatches when
Karsten Hopp a99fff
	    not used.
Karsten Hopp a99fff
Files:	    src/regexp_nfa.c
Karsten Hopp a99fff
Karsten Hopp a99fff
Karsten Hopp a99fff
*** ../vim-7.3.1130/src/regexp_nfa.c	2013-06-05 21:42:49.000000000 +0200
Karsten Hopp a99fff
--- src/regexp_nfa.c	2013-06-06 15:57:14.000000000 +0200
Karsten Hopp a99fff
***************
Karsten Hopp a99fff
*** 319,325 ****
Karsten Hopp a99fff
      post_start = (int *)lalloc(postfix_size, TRUE);
Karsten Hopp a99fff
      if (post_start == NULL)
Karsten Hopp a99fff
  	return FAIL;
Karsten Hopp a99fff
-     vim_memset(post_start, 0, postfix_size);
Karsten Hopp a99fff
      post_ptr = post_start;
Karsten Hopp a99fff
      post_end = post_start + nstate_max;
Karsten Hopp a99fff
      nfa_has_zend = FALSE;
Karsten Hopp a99fff
--- 319,324 ----
Karsten Hopp a99fff
***************
Karsten Hopp a99fff
*** 347,353 ****
Karsten Hopp a99fff
      if (new_start == NULL)
Karsten Hopp a99fff
  	return FAIL;
Karsten Hopp a99fff
      mch_memmove(new_start, post_start, nstate_max * sizeof(int));
Karsten Hopp a99fff
-     vim_memset(new_start + nstate_max, 0, 1000 * sizeof(int));
Karsten Hopp a99fff
      old_start = post_start;
Karsten Hopp a99fff
      post_start = new_start;
Karsten Hopp a99fff
      post_ptr = new_start + (post_ptr - old_start);
Karsten Hopp a99fff
--- 346,351 ----
Karsten Hopp a99fff
***************
Karsten Hopp a99fff
*** 4127,4137 ****
Karsten Hopp a99fff
  
Karsten Hopp a99fff
      /* Allocate memory for the lists of nodes. */
Karsten Hopp a99fff
      size = (nstate + 1) * sizeof(nfa_thread_T);
Karsten Hopp a99fff
!     list[0].t = (nfa_thread_T *)lalloc_clear(size, TRUE);
Karsten Hopp a99fff
      list[0].len = nstate + 1;
Karsten Hopp a99fff
!     list[1].t = (nfa_thread_T *)lalloc_clear(size, TRUE);
Karsten Hopp a99fff
      list[1].len = nstate + 1;
Karsten Hopp a99fff
!     list[2].t = (nfa_thread_T *)lalloc_clear(size, TRUE);
Karsten Hopp a99fff
      list[2].len = nstate + 1;
Karsten Hopp a99fff
      if (list[0].t == NULL || list[1].t == NULL || list[2].t == NULL)
Karsten Hopp a99fff
  	goto theend;
Karsten Hopp a99fff
--- 4125,4135 ----
Karsten Hopp a99fff
  
Karsten Hopp a99fff
      /* Allocate memory for the lists of nodes. */
Karsten Hopp a99fff
      size = (nstate + 1) * sizeof(nfa_thread_T);
Karsten Hopp a99fff
!     list[0].t = (nfa_thread_T *)lalloc(size, TRUE);
Karsten Hopp a99fff
      list[0].len = nstate + 1;
Karsten Hopp a99fff
!     list[1].t = (nfa_thread_T *)lalloc(size, TRUE);
Karsten Hopp a99fff
      list[1].len = nstate + 1;
Karsten Hopp a99fff
!     list[2].t = (nfa_thread_T *)lalloc(size, TRUE);
Karsten Hopp a99fff
      list[2].len = nstate + 1;
Karsten Hopp a99fff
      if (list[0].t == NULL || list[1].t == NULL || list[2].t == NULL)
Karsten Hopp a99fff
  	goto theend;
Karsten Hopp a99fff
***************
Karsten Hopp a99fff
*** 4390,4396 ****
Karsten Hopp a99fff
  			    /* Copy submatch info from the recursive call */
Karsten Hopp a99fff
  			    copy_sub_off(&t->subs.norm, &m->norm);
Karsten Hopp a99fff
  #ifdef FEAT_SYN_HL
Karsten Hopp a99fff
! 			    copy_sub_off(&t->subs.synt, &m->synt);
Karsten Hopp a99fff
  #endif
Karsten Hopp a99fff
  
Karsten Hopp a99fff
  			    /* t->state->out1 is the corresponding
Karsten Hopp a99fff
--- 4388,4395 ----
Karsten Hopp a99fff
  			    /* Copy submatch info from the recursive call */
Karsten Hopp a99fff
  			    copy_sub_off(&t->subs.norm, &m->norm);
Karsten Hopp a99fff
  #ifdef FEAT_SYN_HL
Karsten Hopp a99fff
! 			    if (nfa_has_zsubexpr)
Karsten Hopp a99fff
! 				copy_sub_off(&t->subs.synt, &m->synt);
Karsten Hopp a99fff
  #endif
Karsten Hopp a99fff
  
Karsten Hopp a99fff
  			    /* t->state->out1 is the corresponding
Karsten Hopp a99fff
***************
Karsten Hopp a99fff
*** 4441,4447 ****
Karsten Hopp a99fff
  		    /* Copy submatch info from the recursive call */
Karsten Hopp a99fff
  		    copy_sub_off(&t->subs.norm, &m->norm);
Karsten Hopp a99fff
  #ifdef FEAT_SYN_HL
Karsten Hopp a99fff
! 		    copy_sub_off(&t->subs.synt, &m->synt);
Karsten Hopp a99fff
  #endif
Karsten Hopp a99fff
  		    /* Now we need to skip over the matched text and then
Karsten Hopp a99fff
  		     * continue with what follows. */
Karsten Hopp a99fff
--- 4440,4447 ----
Karsten Hopp a99fff
  		    /* Copy submatch info from the recursive call */
Karsten Hopp a99fff
  		    copy_sub_off(&t->subs.norm, &m->norm);
Karsten Hopp a99fff
  #ifdef FEAT_SYN_HL
Karsten Hopp a99fff
! 		    if (nfa_has_zsubexpr)
Karsten Hopp a99fff
! 			copy_sub_off(&t->subs.synt, &m->synt);
Karsten Hopp a99fff
  #endif
Karsten Hopp a99fff
  		    /* Now we need to skip over the matched text and then
Karsten Hopp a99fff
  		     * continue with what follows. */
Karsten Hopp a99fff
***************
Karsten Hopp a99fff
*** 5053,5059 ****
Karsten Hopp a99fff
  			    /* Copy submatch info from the recursive call */
Karsten Hopp a99fff
  			    copy_sub_off(&t->pim->subs.norm, &m->norm);
Karsten Hopp a99fff
  #ifdef FEAT_SYN_HL
Karsten Hopp a99fff
! 			    copy_sub_off(&t->pim->subs.synt, &m->synt);
Karsten Hopp a99fff
  #endif
Karsten Hopp a99fff
  			}
Karsten Hopp a99fff
  		    }
Karsten Hopp a99fff
--- 5053,5060 ----
Karsten Hopp a99fff
  			    /* Copy submatch info from the recursive call */
Karsten Hopp a99fff
  			    copy_sub_off(&t->pim->subs.norm, &m->norm);
Karsten Hopp a99fff
  #ifdef FEAT_SYN_HL
Karsten Hopp a99fff
! 			    if (nfa_has_zsubexpr)
Karsten Hopp a99fff
! 				copy_sub_off(&t->pim->subs.synt, &m->synt);
Karsten Hopp a99fff
  #endif
Karsten Hopp a99fff
  			}
Karsten Hopp a99fff
  		    }
Karsten Hopp a99fff
***************
Karsten Hopp a99fff
*** 5074,5080 ****
Karsten Hopp a99fff
  			/* Copy submatch info from the recursive call */
Karsten Hopp a99fff
  			copy_sub_off(&t->subs.norm, &t->pim->subs.norm);
Karsten Hopp a99fff
  #ifdef FEAT_SYN_HL
Karsten Hopp a99fff
! 			copy_sub_off(&t->subs.synt, &t->pim->subs.synt);
Karsten Hopp a99fff
  #endif
Karsten Hopp a99fff
  		    }
Karsten Hopp a99fff
  		    else
Karsten Hopp a99fff
--- 5075,5082 ----
Karsten Hopp a99fff
  			/* Copy submatch info from the recursive call */
Karsten Hopp a99fff
  			copy_sub_off(&t->subs.norm, &t->pim->subs.norm);
Karsten Hopp a99fff
  #ifdef FEAT_SYN_HL
Karsten Hopp a99fff
! 			if (nfa_has_zsubexpr)
Karsten Hopp a99fff
! 			    copy_sub_off(&t->subs.synt, &t->pim->subs.synt);
Karsten Hopp a99fff
  #endif
Karsten Hopp a99fff
  		    }
Karsten Hopp a99fff
  		    else
Karsten Hopp a99fff
***************
Karsten Hopp a99fff
*** 5440,5446 ****
Karsten Hopp a99fff
      prog = (nfa_regprog_T *)lalloc(prog_size, TRUE);
Karsten Hopp a99fff
      if (prog == NULL)
Karsten Hopp a99fff
  	goto fail;
Karsten Hopp a99fff
-     vim_memset(prog, 0, prog_size);
Karsten Hopp a99fff
      state_ptr = prog->state;
Karsten Hopp a99fff
  
Karsten Hopp a99fff
      /*
Karsten Hopp a99fff
--- 5442,5447 ----
Karsten Hopp a99fff
*** ../vim-7.3.1130/src/version.c	2013-06-06 14:55:16.000000000 +0200
Karsten Hopp a99fff
--- src/version.c	2013-06-06 16:21:32.000000000 +0200
Karsten Hopp a99fff
***************
Karsten Hopp a99fff
*** 730,731 ****
Karsten Hopp a99fff
--- 730,733 ----
Karsten Hopp a99fff
  {   /* Add new patch number below this line */
Karsten Hopp a99fff
+ /**/
Karsten Hopp a99fff
+     1131,
Karsten Hopp a99fff
  /**/
Karsten Hopp a99fff
Karsten Hopp a99fff
-- 
Karsten Hopp a99fff
There's no place like $(HOME)!
Karsten Hopp a99fff
Karsten Hopp a99fff
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp a99fff
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp a99fff
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp a99fff
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///