Hi,

I have all book on gvim but no one tells me the best practice to have
good performance when we write vimscript.

Example:

I have done some measurements of a vimscript I have made:

1- Storing information data from 3 files into 3 hash (Dict)   :   1
second

first hash => 1000 items
second hash => 3000 items
third hash => 10 items


2- Retrieving and writin data from the 1rst hash => 7 seconds

the func is doing that :

let l:lineToChange = '<tag event="TO_SUBSTITUTE_WITH_KEY">
<tag function="CHT_MODE_TO_SUBSTITUTE_WITH_KEY2
(TO_SUBSTITUTE_WITH_KEY3)">
<execute function="doSomething(TO_SUBSTITUTE_WITH_KEY,2)"/>
</execute>
</tag>'


        for l:key in keys(s:hash)
                let l:line = substitute
(l:lineToChange,"TO_SUBSTITUTE_WITH_KEY",l:key,"g")
                let l:line = substitute(l:line,"TO_SUBSTITUTE_WITH_KEY2",s:hash
[l:key].key2,"")
                let l:line = substitute(l:line,"TO_SUBSTITUTE_WITH_KEY3",s:hash
[l:key].key3,"")
                exec 'norm o' . l:line
        endfor

3- Same than func2 but with 3000 items takes 30 seconds

Can I reduce time ?

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

Reply via email to