Tuesday, August 29, 2023

Vim9 script performance vs. legacy

Hello,

I've been writing my scripts using Vim 9 recently (though without classes) and was wondering if anybody had any performance metrics/benchmarks they would be willing to share that compare Vim 9's speed compared to the same thing written in legacy code.

I find that a significant amount of my script-writing time is used in calling functions such as matchlist, popup_create and the such, which seem to me to be identical (unless you tell me that Vim 9 has access to more optimised version of these).

Maybe the 'for' loop where I iterate over a list of strings is faster in Vim 9 because it's both compiled and statically typed?

One of the things that caught me recently was that popup_create takes a parameter called 'line' which can be either a number or the word 'cursor'. It cannot be the STRING '2', it has to be the NUMBER 2 while 'cursor' is a string. In legacy script, no problem. Here, I had to make it a string variable and then see do something like 'lineNumber != "cursor" ? str2nr(lineNumber) : lineNumber' to convert it to a number if needed. i'm trying to figure out whether there is a measurable speed advantage to going through these motions or if I should just write my scripts in legacy Vim script.

What do people use for their own stuff these days?

Thanks so much, everybody.

--
 
Salman

I, too, shall something make and glory in the making.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CANuxnEd%2BPL_-Vfe9U5yNX3WUiRnrbiDQqu%3DHQ9EMWd45koGd_A%40mail.gmail.com.

No comments:

Post a Comment