To: vim_dev@googlegroups.com Subject: Patch 9.0.0617 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0617 Problem: Calling function for reduce() has too much overhead. Solution: Only call clear_tv() when needed. Files: src/list.c, src/vim9execute.c *** ../vim-9.0.0616/src/list.c 2022-09-28 13:22:53.942530974 +0100 --- src/list.c 2022-09-28 14:44:15.175735510 +0100 *************** *** 3073,3082 **** r = eval_expr_typval(expr, argv, 2, rettv); ! clear_tv(&argv[0]); if (r == FAIL || called_emsg != called_emsg_start) break; if (range_list) { range_val += l->lv_u.nonmat.lv_stride; --- 3073,3084 ---- r = eval_expr_typval(expr, argv, 2, rettv); ! if (argv[0].v_type != VAR_NUMBER && argv[0].v_type != VAR_UNKNOWN) ! clear_tv(&argv[0]); if (r == FAIL || called_emsg != called_emsg_start) break; + // advance to the next item if (range_list) { range_val += l->lv_u.nonmat.lv_stride; *** ../vim-9.0.0616/src/vim9execute.c 2022-09-22 17:33:58.158667760 +0100 --- src/vim9execute.c 2022-09-28 14:32:12.745162881 +0100 *************** *** 710,716 **** return FAIL; funcstack->fs_var_offset = argcount + STACK_FRAME_SIZE; ! funcstack->fs_ga.ga_len = funcstack->fs_var_offset + dfunc->df_varcount; stack = ALLOC_CLEAR_MULT(typval_T, funcstack->fs_ga.ga_len); funcstack->fs_ga.ga_data = stack; if (stack == NULL) --- 710,717 ---- return FAIL; funcstack->fs_var_offset = argcount + STACK_FRAME_SIZE; ! funcstack->fs_ga.ga_len = funcstack->fs_var_offset ! + dfunc->df_varcount; stack = ALLOC_CLEAR_MULT(typval_T, funcstack->fs_ga.ga_len); funcstack->fs_ga.ga_data = stack; if (stack == NULL) *************** *** 5881,5887 **** failed_early: // Free all arguments and local variables. for (idx = 0; idx < ectx.ec_stack.ga_len; ++idx) ! clear_tv(STACK_TV(idx)); ex_nesting_level = orig_nesting_level; vim_free(ectx.ec_stack.ga_data); --- 5882,5892 ---- failed_early: // Free all arguments and local variables. for (idx = 0; idx < ectx.ec_stack.ga_len; ++idx) ! { ! tv = STACK_TV(idx); ! if (tv->v_type != VAR_NUMBER && tv->v_type != VAR_UNKNOWN) ! clear_tv(tv); ! } ex_nesting_level = orig_nesting_level; vim_free(ectx.ec_stack.ga_data); *************** *** 6371,6381 **** break; case ISN_NEWLIST: smsg("%s%4d NEWLIST size %lld", pfx, current, ! (varnumber_T)(iptr->isn_arg.number)); break; case ISN_NEWDICT: smsg("%s%4d NEWDICT size %lld", pfx, current, ! (varnumber_T)(iptr->isn_arg.number)); break; case ISN_NEWPARTIAL: smsg("%s%4d NEWPARTIAL", pfx, current); --- 6376,6386 ---- break; case ISN_NEWLIST: smsg("%s%4d NEWLIST size %lld", pfx, current, ! (varnumber_T)(iptr->isn_arg.number)); break; case ISN_NEWDICT: smsg("%s%4d NEWDICT size %lld", pfx, current, ! (varnumber_T)(iptr->isn_arg.number)); break; case ISN_NEWPARTIAL: smsg("%s%4d NEWPARTIAL", pfx, current); *** ../vim-9.0.0616/src/version.c 2022-09-28 14:08:17.925866871 +0100 --- src/version.c 2022-09-28 15:17:17.991297003 +0100 *************** *** 701,702 **** --- 701,704 ---- { /* Add new patch number below this line */ + /**/ + 617, /**/ -- "You mean there really is an answer?" "Yes! But you're not going to like it!" "Oh do please tell us!" "You're really not going to like it!" "but we MUST know - tell us" "Alright, the answer is...." "yes..." "... is ..." "yes... come on!" "is 42!" (Douglas Adams - The Hitchhiker's Guide to the Galaxy) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///