136782Re: Why is Vimscript/VimL much slower than Python when traversing long lists?
- Mar 18, 2013On 3/15/13, Marc Weber <marco-oweber@...> wrote:
> VimL is known to be slow.Saying that VimL is slow is pointless without explaining exactly what is
slow(er) and by how much. I am not aware of any actual comparisons of
VimL performance vs other scripting languages. My own conclusion from
very few crude tests is that VimL can be much slower than Python when
dealing with long lists and strings, 20 to 100 times slower. In terms of
actual execution times this only begins to matter with sizes >100000
items. Using map(), filter(), etc. instead of "for" loop help somewhat.
Not everything is slow, :g/pattern/... is fast.
> If you know that you need speed use python or external tools.I use Python a lot in my VOoM plugin. You are absolutely right that any
> Why is it the way it is? I don't know.
> Eventually wait for better replies.
> I can recommend using a disnict .py file for writing python because then
> you get all python support (syntax, completion, etc).
> If you want to learn how a .py file can be found by path have a look at
> let s:self=expand('<sfile>:h')
substantial Python code should be in distinct .py files instead of
inside .vim files.
> You may also want to use a str quoting function like this:I usually do
> def vimQuote(s):
> return '"%s"' % s.replace("\\","\\\\").replace('"', '\\"').replace("\n",
> because python's to str comes only close (maybe I should retry the to
> json implementation and find out when whether it fails)
> Marc Weber
"'%s'" % s.replace("'","''")
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@....
For more options, visit https://groups.google.com/groups/opt_out.
- << Previous post in topic Next post in topic >>