Patch 8.2.3311

6 views
Skip to first unread message

Bram Moolenaar

unread,
Aug 7, 2021, 11:20:48 AM8/7/21
to vim...@googlegroups.com

Patch 8.2.3311
Problem: Vim9: check for DO_NOT_FREE_CNT is very slow.
Solution: Move to a separate function so it can be skipped by setting
$TEST_SKIP_PAT.
Files: src/testdir/test_vim9_expr.vim, src/testdir/runtest.vim


*** ../vim-8.2.3310/src/testdir/test_vim9_expr.vim 2021-08-07 15:50:20.183575301 +0200
--- src/testdir/test_vim9_expr.vim 2021-08-07 17:03:30.900632610 +0200
***************
*** 2832,2845 ****
assert_equal('some', get(t:, 'some_var', 'xxx'))
assert_equal('xxx', get(t:, 'no_var', 'xxx'))
unlet t:some_var

# check using g: in a for loop more than DO_NOT_FREE_CNT times
for i in range(100000)
if has_key(g:, 'does-not-exist')
endif
endfor
END
! CheckDefAndScriptSuccess(lines)
enddef

def Test_expr7_parens()
--- 2832,2878 ----
assert_equal('some', get(t:, 'some_var', 'xxx'))
assert_equal('xxx', get(t:, 'no_var', 'xxx'))
unlet t:some_var
+ END
+ CheckDefAndScriptSuccess(lines)
+ enddef

+ def Test_expr7_namespace_loop_def()
+ var lines =<< trim END
# check using g: in a for loop more than DO_NOT_FREE_CNT times
+ var exists = 0
+ var exists_not = 0
for i in range(100000)
if has_key(g:, 'does-not-exist')
+ exists += 1
+ else
+ exists_not += 1
endif
endfor
+ assert_equal(0, exists)
+ assert_equal(100000, exists_not)
END
! CheckDefSuccess(lines)
! enddef
!
! " NOTE: this is known to be slow. To skip use:
! " :let $TEST_SKIP_PAT = 'Test_expr7_namespace_loop_script'
! def Test_expr7_namespace_loop_script()
! var lines =<< trim END
! vim9script
! # check using g: in a for loop more than DO_NOT_FREE_CNT times
! var exists = 0
! var exists_not = 0
! for i in range(100000)
! if has_key(g:, 'does-not-exist')
! exists += 1
! else
! exists_not += 1
! endif
! endfor
! assert_equal(0, exists)
! assert_equal(100000, exists_not)
! END
! CheckScriptSuccess(lines)
enddef

def Test_expr7_parens()
*** ../vim-8.2.3310/src/testdir/runtest.vim 2021-03-22 16:19:37.529354296 +0100
--- src/testdir/runtest.vim 2021-08-07 17:15:15.315470647 +0200
***************
*** 13,18 ****
--- 13,21 ----
" For csh:
" setenv TEST_FILTER Test_channel
"
+ " If the environment variable $TEST_SKIP_PAT is set then test functions
+ " matching this pattern will be skipped. It's the opposite of $TEST_FILTER.
+ "
" While working on a test you can make $TEST_NO_RETRY non-empty to not retry:
" export TEST_NO_RETRY=yes
"
***************
*** 329,341 ****

if s:done == 0
if s:filtered > 0
! let message = "NO tests match $TEST_FILTER: '" .. $TEST_FILTER .. "'"
else
let message = 'NO tests executed'
endif
else
if s:filtered > 0
! call add(s:messages, "Filtered " .. s:filtered .. " tests with $TEST_FILTER")
endif
let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test')
endif
--- 332,348 ----

if s:done == 0
if s:filtered > 0
! if $TEST_FILTER != ''
! let message = "NO tests match $TEST_FILTER: '" .. $TEST_FILTER .. "'"
! else
! let message = "ALL tests match $TEST_SKIP_PAT: '" .. $TEST_SKIP_PAT .. "'"
! endif
else
let message = 'NO tests executed'
endif
else
if s:filtered > 0
! call add(s:messages, "Filtered " .. s:filtered .. " tests with $TEST_FILTER and $TEST_SKIP_PAT")
endif
let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test')
endif
***************
*** 461,466 ****
--- 468,479 ----

" Execute the tests in alphabetical order.
for g:testfunc in sort(s:tests)
+ if $TEST_SKIP_PAT != '' && g:testfunc =~ $TEST_SKIP_PAT
+ call add(s:messages, g:testfunc .. ' matches $TEST_SKIP_PAT')
+ let s:filtered += 1
+ continue
+ endif
+
" Silence, please!
set belloff=all
let prev_error = ''
*** ../vim-8.2.3310/src/version.c 2021-08-07 16:30:35.109065179 +0200
--- src/version.c 2021-08-07 17:19:06.254989309 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3311,
/**/

--
ARTHUR: Be quiet!
DENNIS: --but by a two-thirds majority in the case of more--
ARTHUR: Be quiet! I order you to be quiet!
WOMAN: Order, eh -- who does he think he is?
ARTHUR: I am your king!
The Quest for the Holy Grail (Monty Python)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages