command! -bar TimerStart let start_time = reltime()
command! -bar TimerEnd echo reltimestr(reltime(start_time)) | unlet start_time
function! s:main()
TimerStart
for i in range(1000)
let list = range(10000)
unlet! list[0 : -1]
endfor
TimerEnd
" => 1.062654
TimerStart
for i in range(1000)
let list = range(10000)
unlet! list[0 : len(list)]
endfor
TimerEnd
" => 1.023585
endfunction
call s:main()
Y29tbWFuZCEgLWJhciBUaW1lclN0YXJ0IGxldCBzdGFydF90aW1lID0gcmVsdGltZSgpCmNvbW1hbmQhIC1iYXIgVGltZXJFbmQgICBlY2hvIHJlbHRpbWVzdHIocmVsdGltZShzdGFydF90aW1lKSkgfCB1bmxldCBzdGFydF90aW1lCgpmdW5jdGlvbiEgczptYWluKCkKCVRpbWVyU3RhcnQKCWZvciBpIGluIHJhbmdlKDEwMDApCgkJbGV0IGxpc3QgPSByYW5nZSgxMDAwMCkKCQl1bmxldCEgbGlzdFswIDogLTFdCgllbmRmb3IKCVRpbWVyRW5kCgkiID0+IDEuMDYyNjU0CgoJVGltZXJTdGFydAoJZm9yIGkgaW4gcmFuZ2UoMTAwMCkKCQlsZXQgbGlzdCA9IHJhbmdlKDEwMDAwKQoJCXVubGV0ISBsaXN0WzAgOiBsZW4obGlzdCldCgllbmRmb3IKCVRpbWVyRW5kCgkiID0+IDEuMDIzNTg1CmVuZGZ1bmN0aW9uCmNhbGwgczptYWluKCkK