Skywind wrote:

> The callback of "out_cb" is convenience to use, but has performance issue:
> Gui gets freezed if the background job continues outputing massive data (eg, 
> grep a high frequency word "to" on the documents root, or some crazy stl 
> errors).
> 
> Vim is busy in receiving the data and invoking "out_cb" which cause gui no 
> responsed for a very noticeable period.
> 
> The practice way to prevent gui freeze is introducing a flow control for 
> background process by reading the fixed number of lines from the channel on a 
> timer (eg, read 50 lines from stdout each 100ms interval).
> 
> If the grep output is faster then the reader in the timer, system pipe will 
> be full and "invoking write()" will block the child process until the system 
> pipe buffer has free space again (some data have been readed out by vim).
> 
> In order to process the job output more smoothly, I tried to use this 
> approach but when I am ready to read data from the channel in a timer, It is 
> confused that both "\n" (empty line) and "not enough data" return "" from 
> ch_read().
> 
> If I want to read out at most 100 lines from a channel in an interval, how 
> can I tell if there is no data at the moment or it's just a "\n" from child 
> process ?
> 
> No clue to decide whether to continue reading or just break out.
> 
> When I am using "(pipe object).readline()" from python's subprocess module, 
> "abc\n" means a line "abc", "\n" means an empty line and "" means not enough 
> data. It's very simple without any ambiguity.
> 
> But when I am using "ch_read()" in vim. "abc" means a line "abc", and both 
> (empty line) and (no message) return "".
> 
> Is it a "logic fallacy" of "ch_read()" ??

Can you please try out 8.0.0097 using out_cb and check that it works
better?

-- 
The future isn't what it used to be.

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

Raspunde prin e-mail lui