Friday, August 26, 2011

Re: display faster output of external app

Reply to message «Re: display faster output of external app»,
sent 00:58:15 27 August 2011, Saturday
by niva:

> let g:output=substitute(system(s:cmd),'\n','',"g")
Then you need variant with setline(): it does not care about possible newlines
in g:output,
> rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr value:2940
but you need it with last modification that does not care about `after':
let [d, before; d2]=matchlist(getline('.'),
\'\v^(\s*\S{,'.s:maxlinelength.'})')
let lwidth=strdisplaywidth(before)
call setline('.', before.repeat(' ', 54-lwidth).g:output)

> let g:output=substitute(system(s:cmd),'\n','',"g")
system(s:cmd) produces something like "useful message\n" like `system('echo
"useful message"')' does, am I right? You need just system(s:cmd)[:-2] then.

> Do you see mistake I have made to launch the app?
It will be faster if you won't move the cursor, but use setline({line_number},
{text}) instead. I can't see any mistakes though because I don't see enough
code. Your code is a bit strange (I don't get why you need `output' to be global
and constructed `cmd' to be script-local), but nothing more can be said at this
point.

Original message:
> Ok Ihave modified my app to return random value and it takes time to
> process all those lines
>
> rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr value:2940
> ..
> x18 lines
> ..
> rrrrrrrrrrrrrrrrrrrr value:2966
> rrrrrrrrrrrrrrrrrrrr value:2969
> rrrrrrrrrrrrrrrrrrrr value:2969
>
>
> I am launching the app like that and it takes about 30 seconds/
> 18,~500ms to returnand display valuein vim buffer:
>
> let
> s:cmdbase=shellescape(s:apppath) <=
> done in aninit func
>
> let s:cmd=s:cmdbase.' -rsimu '.itemReadLine[0]." ".type <=
> done in reading lines of buffer
> let g:output=substitute(system(s:cmd),'\n','',"g")
>
> Do you see mistake I have made to launch the app?

No comments: