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.
diff --git a/src/list.c b/src/list.c
index fab86fd..a39c9f9 100644
--- a/src/list.c
+++ b/src/list.c
@@ -3073,10 +3073,12 @@
r = eval_expr_typval(expr, argv, 2, rettv);
- clear_tv(&argv[0]);
+ 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;