Mercurial > vim
diff README_VIM9.md @ 25402:bdda48f01a68
Update runtime files
Commit: https://github.com/vim/vim/commit/53f7fccc9413c9f770694b56f40f242d383b2d5f
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jul 28 20:10:16 2021 +0200
Update runtime files
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 28 Jul 2021 20:15:05 +0200 |
parents | ef454a7f485d |
children | d4faa2c5211b |
line wrap: on
line diff
--- 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 | 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