summaryrefslogtreecommitdiff
path: root/src/macros.h
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-05-13 22:44:22 +0200
committerBram Moolenaar <Bram@vim.org>2020-05-13 22:44:22 +0200
commit7e9f351b2e69b498c4ee5004d7459844e1ba191a (patch)
treedf0c0e40b5bf9ef43d9b1289573515f9de9d79a6 /src/macros.h
parent37d1b4f9416973abe9f5a7c6b81540ca88fa8489 (diff)
downloadvim-git-7e9f351b2e69b498c4ee5004d7459844e1ba191a.tar.gz
patch 8.2.0751: Vim9: performance can be improvedv8.2.0751
Problem: Vim9: performance can be improved. Solution: Don't call break. Inline check for list materialize. Make an inline version of ga_grow().
Diffstat (limited to 'src/macros.h')
-rw-r--r--src/macros.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/macros.h b/src/macros.h
index 9a3d4e13c..2ac705d4a 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -373,3 +373,9 @@
# define ESTACK_CHECK_NOW
# define CHECK_CURBUF
#endif
+
+// Inline the condition for performance.
+#define CHECK_LIST_MATERIALIZE(l) if ((l)->lv_first == &range_list_item) range_list_materialize(l)
+
+// Inlined version of ga_grow(). Especially useful if "n" is a constant.
+#define GA_GROW(gap, n) (((gap)->ga_maxlen - (gap)->ga_len < n) ? ga_grow_inner((gap), (n)) : OK)