summaryrefslogtreecommitdiff
path: root/README_VIM9.md
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-07-28 20:10:16 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-28 20:10:16 +0200
commit53f7fccc9413c9f770694b56f40f242d383b2d5f (patch)
tree6803c702a3f895b63acd2cd8afb4a9737eb47bea /README_VIM9.md
parent327d3ee4557027b51aad86e68743a85ed3a6f52b (diff)
downloadvim-git-53f7fccc9413c9f770694b56f40f242d383b2d5f.tar.gz
Update runtime files
Diffstat (limited to 'README_VIM9.md')
-rw-r--r--README_VIM9.md20
1 files changed, 13 insertions, 7 deletions
diff --git a/README_VIM9.md b/README_VIM9.md
index 96fab69ed..e4d2914f4 100644
--- a/README_VIM9.md
+++ b/README_VIM9.md
@@ -45,14 +45,16 @@ full code is below):
| Vim old | 5.018541 |
| Python | 0.369598 |
| Lua | 0.078817 |
+| LuaJit | 0.004245 |
| Vim new | 0.073595 |
That looks very promising! It's just one example, but it shows how much
we can gain, and also that Vim script can be faster than builtin
interfaces.
-In practice the script would not do something useless as counting but change
-the text. For example, reindent all the lines:
+LuaJit is much faster at Lua-only instructions. In practice the script would
+not do something useless as counting but change the text. For example,
+reindent all the lines:
``` vim
let totallen = 0
@@ -64,13 +66,17 @@ the text. For example, reindent all the lines:
| how | time in sec |
| --------| -------- |
-| Vim old | 0.853752 |
-| Python | 0.304584 |
-| Lua | 0.286573 |
-| Vim new | 0.190276 |
+| Vim old | 0.578598 |
+| Python | 0.152040 |
+| Lua | 0.164917 |
+| LuaJit | 0.128400 |
+| Vim new | 0.079692 |
+
+[These times were measured on a different system by Dominique Pelle]
The differences are smaller, but Vim 9 script is clearly the fastest.
-Using LuaJIT gives 0.25, only a little bit faster than plain Lua.
+Using LuaJIT is only a little bit faster than plain Lua here, clearly the call
+back to the Vim code is costly.
How does Vim9 script work? The function is first compiled into a sequence of
instructions. Each instruction has one or two parameters and a stack is