Patch 8.2.0759 (after 8.2.0751)
Problem:    Vim9: missing changes for performance improvements
Solution:   Use GA_GROW().  Don't call breakcheck so often.
Files:      src/vim9execute.c


*** ../vim-8.2.0758/src/vim9execute.c   2020-05-10 21:47:40.152613769 +0200
--- src/vim9execute.c   2020-05-15 21:37:48.009814327 +0200
***************
*** 128,134 ****
  
      if (count > 0)
        ectx->ec_stack.ga_len -= count - 1;
!     else if (ga_grow(&ectx->ec_stack, 1) == FAIL)
        return FAIL;
      else
        ++ectx->ec_stack.ga_len;
--- 128,134 ----
  
      if (count > 0)
        ectx->ec_stack.ga_len -= count - 1;
!     else if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
        return FAIL;
      else
        ++ectx->ec_stack.ga_len;
***************
*** 437,443 ****
      // Result replaces the arguments on the stack.
      if (argcount > 0)
        ectx->ec_stack.ga_len -= argcount - 1;
!     else if (ga_grow(&ectx->ec_stack, 1) == FAIL)
        return FAIL;
      else
        ++ectx->ec_stack.ga_len;
--- 437,443 ----
      // Result replaces the arguments on the stack.
      if (argcount > 0)
        ectx->ec_stack.ga_len -= argcount - 1;
!     else if (GA_GROW(&ectx->ec_stack, 1) == FAIL)
        return FAIL;
      else
        ++ectx->ec_stack.ga_len;
***************
*** 651,656 ****
--- 651,657 ----
      int               ret = FAIL;
      int               defcount = ufunc->uf_args.ga_len - argc;
      int               save_sc_version = current_sctx.sc_version;
+     int               breakcheck_count = 0;
  
  // Get pointer to item in the stack.
  #define STACK_TV(idx) (((typval_T *)ectx.ec_stack.ga_data) + idx)
***************
*** 749,755 ****
      {
        isn_T       *iptr;
  
!       veryfast_breakcheck();
        if (got_int)
        {
            // Turn CTRL-C into an exception.
--- 750,760 ----
      {
        isn_T       *iptr;
  
!       if (++breakcheck_count >= 100)
!       {
!           line_breakcheck();
!           breakcheck_count = 0;
!       }
        if (got_int)
        {
            // Turn CTRL-C into an exception.
***************
*** 790,796 ****
                if (ectx.ec_frame_idx == initial_frame_idx)
                {
                    // At the toplevel we are done.  Push a dummy return value.
!                   if (ga_grow(&ectx.ec_stack, 1) == FAIL)
                        goto failed;
                    tv = STACK_TV_BOT(0);
                    tv->v_type = VAR_NUMBER;
--- 795,801 ----
                if (ectx.ec_frame_idx == initial_frame_idx)
                {
                    // At the toplevel we are done.  Push a dummy return value.
!                   if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
                        goto failed;
                    tv = STACK_TV_BOT(0);
                    tv->v_type = VAR_NUMBER;
***************
*** 942,948 ****
  
            // load local variable or argument
            case ISN_LOAD:
!               if (ga_grow(&ectx.ec_stack, 1) == FAIL)
                    goto failed;
                copy_tv(STACK_TV_VAR(iptr->isn_arg.number), STACK_TV_BOT(0));
                ++ectx.ec_stack.ga_len;
--- 947,953 ----
  
            // load local variable or argument
            case ISN_LOAD:
!               if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
                    goto failed;
                copy_tv(STACK_TV_VAR(iptr->isn_arg.number), STACK_TV_BOT(0));
                ++ectx.ec_stack.ga_len;
***************
*** 950,956 ****
  
            // load variable or argument from outer scope
            case ISN_LOADOUTER:
!               if (ga_grow(&ectx.ec_stack, 1) == FAIL)
                    goto failed;
                copy_tv(STACK_OUT_TV_VAR(iptr->isn_arg.number),
                                                              STACK_TV_BOT(0));
--- 955,961 ----
  
            // load variable or argument from outer scope
            case ISN_LOADOUTER:
!               if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
                    goto failed;
                copy_tv(STACK_OUT_TV_VAR(iptr->isn_arg.number),
                                                              STACK_TV_BOT(0));
***************
*** 959,965 ****
  
            // load v: variable
            case ISN_LOADV:
!               if (ga_grow(&ectx.ec_stack, 1) == FAIL)
                    goto failed;
                copy_tv(get_vim_var_tv(iptr->isn_arg.number), STACK_TV_BOT(0));
                ++ectx.ec_stack.ga_len;
--- 964,970 ----
  
            // load v: variable
            case ISN_LOADV:
!               if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
                    goto failed;
                copy_tv(get_vim_var_tv(iptr->isn_arg.number), STACK_TV_BOT(0));
                ++ectx.ec_stack.ga_len;
***************
*** 974,980 ****
  
                    sv = ((svar_T *)si->sn_var_vals.ga_data)
                                             + iptr->isn_arg.script.script_idx;
!                   if (ga_grow(&ectx.ec_stack, 1) == FAIL)
                        goto failed;
                    copy_tv(sv->sv_tv, STACK_TV_BOT(0));
                    ++ectx.ec_stack.ga_len;
--- 979,985 ----
  
                    sv = ((svar_T *)si->sn_var_vals.ga_data)
                                             + iptr->isn_arg.script.script_idx;
!                   if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
                        goto failed;
                    copy_tv(sv->sv_tv, STACK_TV_BOT(0));
                    ++ectx.ec_stack.ga_len;
***************
*** 996,1002 ****
                    }
                    else
                    {
!                       if (ga_grow(&ectx.ec_stack, 1) == FAIL)
                            goto failed;
                        copy_tv(&di->di_tv, STACK_TV_BOT(0));
                        ++ectx.ec_stack.ga_len;
--- 1001,1007 ----
                    }
                    else
                    {
!                       if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
                            goto failed;
                        copy_tv(&di->di_tv, STACK_TV_BOT(0));
                        ++ectx.ec_stack.ga_len;
***************
*** 1044,1050 ****
                    }
                    else
                    {
!                       if (ga_grow(&ectx.ec_stack, 1) == FAIL)
                            goto failed;
                        copy_tv(&di->di_tv, STACK_TV_BOT(0));
                        ++ectx.ec_stack.ga_len;
--- 1049,1055 ----
                    }
                    else
                    {
!                       if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
                            goto failed;
                        copy_tv(&di->di_tv, STACK_TV_BOT(0));
                        ++ectx.ec_stack.ga_len;
***************
*** 1060,1066 ****
  
                    // This is not expected to fail, name is checked during
                    // compilation: don't set SOURCING_LNUM.
!                   if (ga_grow(&ectx.ec_stack, 1) == FAIL)
                        goto failed;
                    if (get_option_tv(&name, &optval, TRUE) == FAIL)
                        goto failed;
--- 1065,1071 ----
  
                    // This is not expected to fail, name is checked during
                    // compilation: don't set SOURCING_LNUM.
!                   if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
                        goto failed;
                    if (get_option_tv(&name, &optval, TRUE) == FAIL)
                        goto failed;
***************
*** 1075,1081 ****
                    typval_T    optval;
                    char_u      *name = iptr->isn_arg.string;
  
!                   if (ga_grow(&ectx.ec_stack, 1) == FAIL)
                        goto failed;
                    // name is always valid, checked when compiling
                    (void)get_env_tv(&name, &optval, TRUE);
--- 1080,1086 ----
                    typval_T    optval;
                    char_u      *name = iptr->isn_arg.string;
  
!                   if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
                        goto failed;
                    // name is always valid, checked when compiling
                    (void)get_env_tv(&name, &optval, TRUE);
***************
*** 1086,1092 ****
  
            // load @register
            case ISN_LOADREG:
!               if (ga_grow(&ectx.ec_stack, 1) == FAIL)
                    goto failed;
                tv = STACK_TV_BOT(0);
                tv->v_type = VAR_STRING;
--- 1091,1097 ----
  
            // load @register
            case ISN_LOADREG:
!               if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
                    goto failed;
                tv = STACK_TV_BOT(0);
                tv->v_type = VAR_STRING;
***************
*** 1334,1340 ****
            case ISN_PUSHFUNC:
            case ISN_PUSHCHANNEL:
            case ISN_PUSHJOB:
!               if (ga_grow(&ectx.ec_stack, 1) == FAIL)
                    goto failed;
                tv = STACK_TV_BOT(0);
                ++ectx.ec_stack.ga_len;
--- 1339,1345 ----
            case ISN_PUSHFUNC:
            case ISN_PUSHCHANNEL:
            case ISN_PUSHJOB:
!               if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
                    goto failed;
                tv = STACK_TV_BOT(0);
                ++ectx.ec_stack.ga_len;
***************
*** 1434,1440 ****
  
                    if (count > 0)
                        ectx.ec_stack.ga_len -= 2 * count - 1;
!                   else if (ga_grow(&ectx.ec_stack, 1) == FAIL)
                        goto failed;
                    else
                        ++ectx.ec_stack.ga_len;
--- 1439,1445 ----
  
                    if (count > 0)
                        ectx.ec_stack.ga_len -= 2 * count - 1;
!                   else if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
                        goto failed;
                    else
                        ++ectx.ec_stack.ga_len;
***************
*** 1554,1560 ****
                    pt = ALLOC_CLEAR_ONE(partial_T);
                    if (pt == NULL)
                        goto failed;
!                   if (ga_grow(&ectx.ec_stack, 1) == FAIL)
                    {
                        vim_free(pt);
                        goto failed;
--- 1559,1565 ----
                    pt = ALLOC_CLEAR_ONE(partial_T);
                    if (pt == NULL)
                        goto failed;
!                   if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
                    {
                        vim_free(pt);
                        goto failed;
***************
*** 1632,1638 ****
                                   STACK_TV_VAR(iptr->isn_arg.forloop.for_idx);
  
                    // push the next item from the list
!                   if (ga_grow(&ectx.ec_stack, 1) == FAIL)
                        goto failed;
                    if (++idxtv->vval.v_number >= list->lv_len)
                        // past the end of the list, jump to "endfor"
--- 1637,1643 ----
                                   STACK_TV_VAR(iptr->isn_arg.forloop.for_idx);
  
                    // push the next item from the list
!                   if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
                        goto failed;
                    if (++idxtv->vval.v_number >= list->lv_len)
                        // past the end of the list, jump to "endfor"
***************
*** 1663,1669 ****
                {
                    trycmd_T    *trycmd = NULL;
  
!                   if (ga_grow(&ectx.ec_trystack, 1) == FAIL)
                        goto failed;
                    trycmd = ((trycmd_T *)ectx.ec_trystack.ga_data)
                                                     + ectx.ec_trystack.ga_len;
--- 1668,1674 ----
                {
                    trycmd_T    *trycmd = NULL;
  
!                   if (GA_GROW(&ectx.ec_trystack, 1) == FAIL)
                        goto failed;
                    trycmd = ((trycmd_T *)ectx.ec_trystack.ga_data)
                                                     + ectx.ec_trystack.ga_len;
***************
*** 1682,1688 ****
                    iemsg("Evaluating catch while current_exception is NULL");
                    goto failed;
                }
!               if (ga_grow(&ectx.ec_stack, 1) == FAIL)
                    goto failed;
                tv = STACK_TV_BOT(0);
                ++ectx.ec_stack.ga_len;
--- 1687,1693 ----
                    iemsg("Evaluating catch while current_exception is NULL");
                    goto failed;
                }
!               if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
                    goto failed;
                tv = STACK_TV_BOT(0);
                ++ectx.ec_stack.ga_len;
*** ../vim-8.2.0758/src/version.c       2020-05-15 20:52:55.793511801 +0200
--- src/version.c       2020-05-15 21:35:02.850390001 +0200
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     759,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
96. On Super Bowl Sunday, you followed the score by going to the
    Yahoo main page instead of turning on the TV.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202005151943.04FJhJFu005757%40masaka.moolenaar.net.

Raspunde prin e-mail lui