Monday, March 18, 2013

Re: Why is Vimscript/VimL much slower than Python when traversing long lists?

On 3/15/13, Salman Halim <salmanhalim@gmail.com> wrote:
...
> It's entirely possible that the loop in question was simply left out as a
> compiler optimization. Modern compilers can detect no-op loops and
> unchanging assignments and take these things out of the compiled code.
>
> Salman
>
>
> --
> سلمان حلیم

This is not the case here. It's easy to check that the time it takes to
run the no-op Python loop is proportional to the number of steps, which
means it is not skipped:

let start = reltime()
python for i in range(10000000): pass
echo reltimestr(reltime(start))
let start = reltime()
python for i in range(100000): pass
echo reltimestr(reltime(start))

I also tried adding some code to the body of each loop in my first
example and still got about 30-fold difference.

Regards,
Vlad

--
--
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.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: