Patch 7.4.362

223 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 9, 2014, 2:21:03 PM7/9/14
to vim...@googlegroups.com

Patch 7.4.362
Problem: When matchaddpos() uses a length smaller than the number of bytes
in the (last) character the highlight continues until the end of
the line.
Solution: Change condition from equal to larger-or-equal.
Files: src/screen.c


*** ../vim-7.4.361/src/screen.c 2014-07-03 22:54:04.911859458 +0200
--- src/screen.c 2014-07-09 20:14:46.611627298 +0200
***************
*** 3852,3858 ****
{
shl->attr_cur = shl->attr;
}
! else if (v == (long)shl->endcol)
{
shl->attr_cur = 0;
next_search_hl(wp, shl, lnum, (colnr_T)v, cur);
--- 3852,3858 ----
{
shl->attr_cur = shl->attr;
}
! else if (v >= (long)shl->endcol)
{
shl->attr_cur = 0;
next_search_hl(wp, shl, lnum, (colnr_T)v, cur);
*** ../vim-7.4.361/src/version.c 2014-07-09 19:58:21.115647328 +0200
--- src/version.c 2014-07-09 20:20:14.423620635 +0200
***************
*** 736,737 ****
--- 736,739 ----
{ /* Add new patch number below this line */
+ /**/
+ 362,
/**/

--
Compilation process failed successfully.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Akio Ito

unread,
Jul 9, 2014, 11:25:20 PM7/9/14
to vim...@googlegroups.com
This patch make to use excessive CPU when scroll in my MacVim. Edited text had multibyte japanese characters(utf8).

Bram Moolenaar

unread,
Jul 10, 2014, 5:56:32 AM7/10/14
to Akio Ito, vim...@googlegroups.com

Akio Ito wrote:

> This patch make to use excessive CPU when scroll in my MacVim. Edited
> text had multibyte japanese characters(utf8).

Hmm, I would not expect any slow down because of this patch. Are you
sure it's not something else? Ideally you would reverse this specific
patch and check if the excessive CPU still happens.

--
ARTHUR: What does it say?
BROTHER MAYNARD: It reads ... "Here may be found the last words of Joseph of
Aramathea." "He who is valorous and pure of heart may find
the Holy Grail in the aaaaarrrrrrggghhh..."
ARTHUR: What?
BROTHER MAYNARD: "The Aaaaarrrrrrggghhh..."
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

Akio Ito

unread,
Jul 11, 2014, 8:33:18 PM7/11/14
to vim...@googlegroups.com, ito...@gmail.com
On Thursday, July 10, 2014 6:56:32 PM UTC+9, Bram Moolenaar wrote:
> Hmm, I would not expect any slow down because of this patch. Are you
> sure it's not something else? Ideally you would reverse this specific
> patch and check if the excessive CPU still happens.

Bram, apologies for sending private message by mistake.

Scroll text like a crazy with trackpad (iMac with 4 Cores)
Patched version: aprox. max 70% CPU usage
Unpatched version: aprox. max 35% CPU usage

I find a reasonable work around for sluggishness in normal scrolling changing my .vimrc:
< let g:syntax = '???'
< let g:currentTag = '???'
< autocmd CursorHold * let g:syntax = SyntaxItem()
< autocmd CursorHold * let g:currentTag = tagbar#currenttag('%s','','s')
<
---
>
271c266
< set statusline+=%3*\ %{g:currentTag}\
---
> set statusline+=%3*\ %{tagbar#currenttag('%s','','s')}\
273c268
< set statusline+=%5*\ %=%{g:syntax}
---
> set statusline+=%5*\ %=%{SyntaxItem()}

h_east

unread,
Aug 15, 2014, 12:08:29 PM8/15/14
to vim...@googlegroups.com
Bram,

2014/7/10(Thu) 3:21:03 UTC+9 Bram Moolenaar:

After patch 7.4.362, Processing time is slow under certain conditions.

That condition is 'set hlsearch' and 'set cursorline'.

I've prepared a script file(test603.vim) for verification.
"====================================================
function! T()
call cursor(1, 1)
let t = reltime()
for l in range(1, line('$'))
call cursor(l, 1)
redraw
endfor
echo reltimestr(reltime(t))
endfunction

function! S()
let s = []
for l in range(1, line('$'))
let s += ['\%' . l . 'l\%(abcde\)']
endfor
let @/ = join(s, '\|')
endfunction

:set hlsearch
:set cursorline
:call setline(1, repeat(['abcdef'], 100))
:call S()
:call T()
"====================================================

Exec below.
$ vim -N -u test603.vim

Exec result:
Vim Ver. Elasped time
7.4.131 0.045500
7.4.361 0.046550
7.4.362 1.136427 <-- It is 25 times slower.
7.4.398 1.135489

I think patch 7.4.362 is not enough multi-byte support.

I wrote a patch.
Vim 7.4.404 with my patch elapsed time is 0.053999!
Please check this.


PS
I will send report at a later date about the phenomenon that underline will remain even after the end of Vim in gnome-terminal, mlterm and xterm.

Thank you.
--
Best regards,
Hirohito Higashi

hlsearch_and_cursorline_slow.patch

Bram Moolenaar

unread,
Aug 15, 2014, 4:41:51 PM8/15/14
to h_east, vim...@googlegroups.com
Thanks! Others also reported the problem and the solution from
Christian didn't work completely.

--
I'm not familiar with this proof, but I'm aware of a significant
following of toddlers who believe that peanut butter is the solution
to all of life's problems... -- Tim Hammerquist

Yukihiro Nakadaira

unread,
Aug 15, 2014, 9:14:35 PM8/15/14
to vim...@googlegroups.com

It doesn't work when highlighting multiple characters.

$ vim -u NONE
:set encoding=utf-8
:call setline(1, 'aáaaa')
:hi Test guibg=red ctermbg=red
:call matchaddpos('Test', [[1, 1, 2]])

--
Yukihiro Nakadaira - yukihiro....@gmail.com

Christian Brabandt

unread,
Aug 16, 2014, 8:57:23 AM8/16/14
to vim...@googlegroups.com
Can you all please check, if all your issues also occur with the patch
from here:
https://groups.google.com/forum/#!msg/vim_use/V6cRWX4c13E/qh3YCUESU0kJ

Thanks,

Best,
Christian
--

h_east

unread,
Aug 16, 2014, 9:20:36 AM8/16/14
to vim...@googlegroups.com
Hi Yukihiro ,Christian and Bram

2014/8/16(Sat) 10:14:35 UTC+9 Yukihiro Nakadaira:


> It doesn't work when highlighting multiple characters.
>
> $ vim -u NONE
> :set encoding=utf-8

> :call setline(1, 'aaaaa')


> :hi Test guibg=red ctermbg=red
>
> :call matchaddpos('Test', [[1, 1, 2]])

Thanks for bug report!

I update a patch. (Attached)


2014/8/16(Sat) 21:57:23 UTC+9 Christian Brabandt:


> Can you all please check, if all your issues also occur with the patch
>
> from here:
>
> https://groups.google.com/forum/#!msg/vim_use/V6cRWX4c13E/qh3YCUESU0kJ

Thanks for report.
I will check them soon in my new patch.

hlsearch_and_cursorline_slow_2.patch

h_east

unread,
Aug 16, 2014, 10:20:11 AM8/16/14
to vim...@googlegroups.com
Hi Christian and Bram,

2014/8/16(Sat) 22:20:36 UTC+9 h_east:


> > Can you all please check, if all your issues also occur with the patch
> >
> > from here:
> >
> > https://groups.google.com/forum/#!msg/vim_use/V6cRWX4c13E/qh3YCUESU0kJ
>
> Thanks for report.
> I will check them soon in my new patch.

I checked. My patch fixed this problem.

Bram Moolenaar

unread,
Aug 16, 2014, 10:29:00 AM8/16/14
to h_east, vim...@googlegroups.com
Thanks. I think I have found a simpler solution, I'll send it next.
Please check it works for you.


--
The technology involved in making anything invisible is so infinitely
complex that nine hundred and ninety-nine billion, nine hundred and
ninety-nine million, nine hundred and ninety-nine thousand, nine hundred
and ninety-nine times out of a trillion it is much simpler and more
effective just to take the thing away and do without it.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
Reply all
Reply to author
Forward
0 new messages