Thursday, December 24, 2009

Re: Best practice to put lines into new buffer

On 23 déc, 21:23, Christian Brabandt <cbli...@256bit.org> wrote:
> Hi epanda!
>
> On Mi, 23 Dez 2009, epanda wrote:
>
> > Hi,
>
> > I have some data into Dict or List
>
> > I use actually this command in order to put data from my List to the
> > current buffer and saving it to a new file.
>
> > let newContent .= join(g:myListOfLines,'')
> > exec 'norm O' . newContent
>
> > Is there a better solution to have a real gain of time ?
>
> Well you could test usinghttp://www.vim.org/scripts/script.php?script_id=1530
>
> Here is a simple test case:
> :TIME 100 :call append('$', join(g:a))
> Execution took   0.005195 sec. (count=100)
> :TIME 100 :put =join(g:a)
> Execution took   0.004757 sec. (count=100)
> :TIME :exe 'norm o'.join(g:a)
> Execution took   0.036771 sec. (count=100)
>
> So :exe 'norm o' is one order of magnitude slower. But I am interested
> in your timings.
>
> regards,
> Christian
> --
> :wq


Hi Christian,

I have found with Tim that my script took too time cause of "norm o"
instruct
I use now a varString and put = at the end of generation.

I have downgrade vim to 7.2 instead of 7.2.310 and using profile to
measure my funcs,

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment