On Jun 29, 6:20 pm, Ted <[email protected]> wrote:
> I'm wondering if there are some figures somewhere that would provide
> some sort of estimate of the percentage of vim users who have python
> installed, or would be free of objections to installing it if a module
> required it. .....
If I had to make a completely wild guess on python support, I'd say
maybe 50% of Vim script users have python-enabled Vim, and another 25%
could very easily install it. If your plugin is significantly better
using python I'd say go ahead and use it. However VimL isn't half bad,
and will probably have everything you need. So in that case it may be
silly to endanger 50% of your audience due to your personal language
preference.
Python has a few strong advantages, beyond the great standard
libraries. One of the reasons I moved Conque from VimL to python was
the very poor performance of VimL when writing to a buffer. This seems
counter intuitive, but for some reason the python buffer variable is
almost 10 times faster at updating a buffer than the builtin VimL
functions getline()/setline(). So if your plugin has to write large
amounts of content to a buffer, this would be something to take into
consideration.
A sample script to show what I mean:
"
---------------------------------------------------------------------------
" profile results
-------------------------------------------------------
FUNCTION ScreenWriteBenchPy()
Called 1 time
Total time: 2.697767
Self time: 2.697767
count total (s) self (s)
1 2.697753 python SWB()
FUNCTION ScreenWriteBench()
Called 1 time
Total time: 20.614985
Self time: 20.614985
count total (s) self (s)
501 0.003105 for k in range(1, 500)
500 0.054599 normal ggdG
50500 0.301234 for j in range(1, 100)
550000 3.337009 for i in range(1,10)
500000 7.288676 call setline(i,
getline(i) . i . j)
500000 2.684931 endfor
50000 0.228279 endfor
500 0.002241 endfor
"
---------------------------------------------------------------------------
" test.vim
---------------------------------------------------------------
function! ScreenWriteBench()
for k in range(1, 500)
normal ggdG
for j in range(1, 100)
for i in range(1,10)
call setline(i, getline(i) . i . j)
endfor
endfor
endfor
endfunction
function! ScreenWriteBenchPy()
python SWB()
endfunction
python << EOF
import vim
def SWB():
for k in range(1, 501):
del vim.current.buffer[0:10]
for j in range(1, 101):
for i in range(1,11):
if len(vim.current.buffer) < i:
vim.current.buffer.append('')
vim.current.buffer[i-1] += str(i) + str(j)
EOF
--
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