mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 9.0.0617: calling function for reduce() has too much overhead
Problem: Calling function for reduce() has too much overhead. Solution: Only call clear_tv() when needed.
This commit is contained in:
@@ -3073,10 +3073,12 @@ list_reduce(
|
||||
|
||||
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;
|
||||
|
@@ -699,6 +699,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
617,
|
||||
/**/
|
||||
616,
|
||||
/**/
|
||||
|
@@ -710,7 +710,8 @@ handle_closure_in_use(ectx_T *ectx, int free_arguments)
|
||||
return FAIL;
|
||||
|
||||
funcstack->fs_var_offset = argcount + STACK_FRAME_SIZE;
|
||||
funcstack->fs_ga.ga_len = funcstack->fs_var_offset + dfunc->df_varcount;
|
||||
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,7 +5882,11 @@ call_def_function(
|
||||
failed_early:
|
||||
// Free all arguments and local variables.
|
||||
for (idx = 0; idx < ectx.ec_stack.ga_len; ++idx)
|
||||
clear_tv(STACK_TV(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);
|
||||
|
Reference in New Issue
Block a user