summaryrefslogtreecommitdiff
path: root/README_VIM9.md
diff options
context:
space:
mode:
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