On Tue, Aug 26, 2014 at 4:32 PM, Bram Moolenaar <[email protected]> wrote:
>
> Yasuhiro Matsumoto wrote:
>
>> When vim allocate many objects, some times vim hang for GC. Ariya Mizutani 
>> suggested below's patch.
>>
>> https://gist.github.com/mattn/0c58a7398c63ab4c3066
>>
>> Try following test code.
>> ----------------------------------------------
>> let s:hoge = {}
>> let s:fuga = {}
>> let s:arr = []
>>
>> function! Prepare() abort " {{{
>>   let s:hoge.a1 = map(range(1, 50000), '{}')
>>   let s:hoge.a2 = map(range(1, 50000), '{}')
>>   let s:hoge.a3 = map(range(1, 50000), '{}')
>>   let s:hoge.fuga = s:fuga
>>   let s:fuga.hoge = s:hoge
>> endfunction " }}}
>>
>> function! Release() abort " {{{
>>   let s:arr = s:hoge.a2
>>   unlet s:hoge
>>   unlet s:fuga
>> endfunction " }}}
>>
>> let start = reltime()
>> call Prepare()
>> call Release()
>> call garbagecollect()
>> echomsg string(reltimestr(reltime(start)))
>> ----------------------------------------------
>>
>> Without this patch, it take 100 seconds to finish GC. And if set 100000 
>> instead of 50000, vim often hangs. With this patch, it take just 0.133967 
>> seconds. This patch avoid linear-search for freeing items.
>> I think this is awesome patch for vim because people uses many plugins 
>> recently.
>> I tried this patch few days. I don't see any problems.
>
> This looks too simple.  There is a remark that the next dict may have
> been freed, I think that was there for a good reason (dict containing a
> dict).

That comment is outdated since 7.0.135 (noticed by @oni-link):

https://code.google.com/p/vim/source/detail?r=v7-0-135


Justin M. Keyes

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui