Re: Patch 7.4.362

2014-08-16 Fir de Conversatie Christian Brabandt
On Fr, 15 Aug 2014, h_east wrote:

 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.

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
-- 

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.362

2014-08-16 Fir de Conversatie h_east
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, 'a')
 :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.

--
Best regards,
Hirohito Higashi

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
diff -r 18fd959b07ef src/screen.c
--- a/src/screen.c	Wed Aug 13 22:05:54 2014 +0200
+++ b/src/screen.c	Sat Aug 16 20:13:23 2014 +0900
@@ -2911,6 +2911,7 @@
 int		mb_c = 0;		/* decoded multi-byte character */
 int		mb_utf8 = FALSE;	/* screen char is UTF-8 char */
 int		u8cc[MAX_MCO];		/* composing UTF-8 chars */
+int		hl_len = 0;
 #endif
 #ifdef FEAT_DIFF
 int		filler_lines;		/* nr of filler lines to be drawn */
@@ -3832,6 +3833,10 @@
 		 * priority).
 		 */
 		v = (long)(ptr - line);
+#ifdef FEAT_MBYTE
+		if (has_mbyte)
+		hl_len += (*mb_ptr2len)(ptr);
+#endif
 		cur = wp-w_match_head;
 		shl_flag = FALSE;
 		while (cur != NULL || shl_flag == FALSE)
@@ -3857,10 +3862,17 @@
  v  (long)shl-endcol)
 			{
 			shl-attr_cur = shl-attr;
+#ifdef FEAT_MBYTE
+			if (has_mbyte  shl-endcol  hl_len)
+shl-endcol = hl_len;
+#endif
 			}
-			else if (v = (long)shl-endcol)
+			else if (v == (long)shl-endcol)
 			{
 			shl-attr_cur = 0;
+#ifdef FEAT_MBYTE
+			hl_len = 0;
+#endif
 			next_search_hl(wp, shl, lnum, (colnr_T)v, cur);
 			pos_inprogress = cur == NULL || cur-pos.cur == 0
 			  ? FALSE : TRUE;


Re: Patch 7.4.362

2014-08-16 Fir de Conversatie h_east
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.

--
Best regards,
Hirohito Higashi

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.362

2014-08-16 Fir de Conversatie Bram Moolenaar

Hirohito Higashi wrote:

 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, 'a')
  :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.

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

 /// Bram Moolenaar -- b...@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///

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.362

2014-08-15 Fir de Conversatie h_east
Bram,

2014/7/10(Thu) 3:21:03 UTC+9 Bram Moolenaar:
 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,
 
   /**/

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

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
diff -r 18fd959b07ef src/screen.c
--- a/src/screen.c	Wed Aug 13 22:05:54 2014 +0200
+++ b/src/screen.c	Fri Aug 15 23:07:22 2014 +0900
@@ -3856,9 +3856,20 @@
  v = (long)shl-startcol
  v  (long)shl-endcol)
 			{
+			int vlen;
+
 			shl-attr_cur = shl-attr;
+#ifdef FEAT_MBYTE
+			if (has_mbyte)
+			{
+int vlen = (*mb_ptr2len)(line + v);
+
+if (shl-endcol - shl-startcol  vlen)
+shl-endcol = shl-startcol + vlen;
+			}
+#endif
 			}
-			else if (v = (long)shl-endcol)
+			else if (v == (long)shl-endcol)
 			{
 			shl-attr_cur = 0;
 			next_search_hl(wp, shl, lnum, (colnr_T)v, cur);


Re: Patch 7.4.362

2014-08-15 Fir de Conversatie Bram Moolenaar

Hirohito Higashi wrote:

 Bram,
 
 2014/7/10(Thu) 3:21:03 UTC+9 Bram Moolenaar:
  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.c2014-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.c2014-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,
/**/
 
 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.

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

 /// Bram Moolenaar -- b...@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///

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.362

2014-08-15 Fir de Conversatie Yukihiro Nakadaira
On Sat, Aug 16, 2014 at 1:08 AM, h_east h.east@gmail.com wrote:

 Bram,

 2014/7/10(Thu) 3:21:03 UTC+9 Bram Moolenaar:
  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,
 
/**/

 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.


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.nakada...@gmail.com

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.362

2014-07-11 Fir de Conversatie Akio Ito
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()}

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.362

2014-07-10 Fir de Conversatie Bram Moolenaar

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 arrggghhh...
ARTHUR:  What?
BROTHER MAYNARD: The Arrggghhh...
 Monty Python and the Holy Grail PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- b...@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///

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.362

2014-07-09 Fir de Conversatie Akio Ito
This patch make to use excessive CPU when scroll in my MacVim. Edited text had 
multibyte japanese characters(utf8).

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.