Re: system() delay

2016-08-29 Fir de Conversatie Ramel Eshed
On Monday, August 29, 2016 at 8:35:33 AM UTC+3, Dominique Pelle wrote: > Ramel wrote: > > > Nice catch! > > My 'shell' was tcsh and after changing it to /bin/sh (=bash) System() works > > much better (only ~x2 slower than Job()). I probably wouldn't get into this > > if I got

Re: system() delay

2016-08-29 Fir de Conversatie Bram Moolenaar
Ramel Eshed wrote: > On Sunday, August 28, 2016 at 11:36:33 PM UTC+3, Bram Moolenaar wrote: > > Ramel Eshed wrote: > > > > > Of course, I've measured the time from job_start to close_cb. You can see > > > this comparison in the example I've attached earlier in this thread. > > > > Hmm, it's

Re: system() delay

2016-08-28 Fir de Conversatie Dominique Pellé
Ramel wrote: > Nice catch! > My 'shell' was tcsh and after changing it to /bin/sh (=bash) System() works > much better (only ~x2 slower than Job()). I probably wouldn't get into this > if I got these results in the first place.. still, I'm going to use the > above blocking

Re: system() delay

2016-08-28 Fir de Conversatie Ramel
Nice catch! My 'shell' was tcsh and after changing it to /bin/sh (=bash) System() works much better (only ~x2 slower than Job()). I probably wouldn't get into this if I got these results in the first place.. still, I'm going to use the above blocking version of job_start (it is as fast as Job())

Re: system() delay

2016-08-28 Fir de Conversatie Dominique Pellé
Ramel Eshed wrote: > My problem is not with the channel, the problem is > that system() is slower than the equivalent job_start(). > You can run and compare the results of Job() and System() > functions in the attached file. They are both doing the same > thing ('echo aaa')

Re: system() delay

2016-08-28 Fir de Conversatie Ramel Eshed
On Sunday, August 28, 2016 at 11:36:33 PM UTC+3, Bram Moolenaar wrote: > Ramel Eshed wrote: > > > Of course, I've measured the time from job_start to close_cb. You can see > > this comparison in the example I've attached earlier in this thread. > > Hmm, it's possible that detecting that the

Re: system() delay

2016-08-28 Fir de Conversatie Bram Moolenaar
Ramel Eshed wrote: > Of course, I've measured the time from job_start to close_cb. You can see > this comparison in the example I've attached earlier in this thread. Hmm, it's possible that detecting that the other end closed the pipe happens much sooner than detecting that the child process

Re: system() delay

2016-08-28 Fir de Conversatie Ramel
> > That's exactly what I've did: > > > > > > > > > > > > > > > > > > func! Job() > > > > > > > > > let s:rt = reltime() > > > > > > > > > let g:output = [] > > > > > > > > >

Re: system() delay

2016-08-28 Fir de Conversatie Bram Moolenaar
> > > > > > > > > > > > > > That's exactly what I've did: > > > > > > > > > > > > > > > > func! Job() > > > > > > > > let s:rt = reltime() > > > > > &

Re: system() delay

2016-08-28 Fir de Conversatie Ramel Eshed
> > > > > > > > > That's exactly what I've did: > > > > > > > > > > > > > > func! Job() > > > > > > > let s:rt = reltime() > > > > > > > let g:output = [] > > >

Re: system() delay

2016-08-28 Fir de Conversatie Bram Moolenaar
gt; > > > > func! Job() > > > > > > let s:rt = reltime() > > > > > > let g:output = [] > > > > > > let g:job = job_start(['/bin/sh', '-c', 'cat ' . expand('%')], > > > > > > {'out_cb': function('s:ou

Re: system() delay

2016-08-27 Fir de Conversatie Ramel Eshed
t s:rt = reltime() > > > > > let g:output = [] > > > > > let g:job = job_start(['/bin/sh', '-c', 'cat ' . expand('%')], > > > > > {'out_cb': function('s:out_cb'), 'close_cb': function('s:close_cb')}) > > > > > endfunc > > > >

Re: system() delay

2016-08-26 Fir de Conversatie Bram Moolenaar
s:out_cb(channel, msg) > > > > call add(g:output, a:msg) > > > > endfunc > > > > > > > > func! s:close_cb(channel) > > > > echo reltimestr(reltime(s:rt)) > > > > "echo g:output > > > > endfunc > > &

Re: system() delay

2016-08-26 Fir de Conversatie Ramel Eshed
tion('s:close_cb')}) > > > endfunc > > > > > > func! s:out_cb(channel, msg) > > > call add(g:output, a:msg) > > > endfunc > > > > > > func! s:close_cb(channel) > > > echo reltimestr(reltime(s:rt)) > > > &quo

Re: system() delay

2016-08-25 Fir de Conversatie Bram Moolenaar
t;echo g:output > > endfunc > > > > " compare with: > > > > func! System() > > let s:rt = reltime() > > let g:output = systemlist('cat ' . expand('%')) > > echo reltimestr(reltime(s:rt)) > > endfunc > > > > &qu

Re: system() delay

2016-08-10 Fir de Conversatie Ramel Eshed
;"""""""""" I checked it now on my Ubuntu at home - I still see the difference but now both are much faster so even the system() delay is not noticeable. Any idea what could cause the delay on my RHEL? BTW, if I remove the comment from the 'ec

Re: system() delay

2016-08-10 Fir de Conversatie Tony Mechelynck
There are other factors which are right there in the help: - job_start() returns a Job object and doesn't wait for the job to finish - system() waits for the external command to finish and returns its full stdout output as a string. I don't know Vim job control really well, but I seem to

Re: system() delay

2016-08-10 Fir de Conversatie Ramel Eshed
On Thursday, August 11, 2016 at 12:57:27 AM UTC+3, Dominique Pelle wrote: > Ramel Eshed ]wrote: > > > Hi Bram, > > > > I noticed that using system() function has an overhead of 0.2 seconds > > (checked on RHEL 5.5) while using job_start() is 10 times faster (from > > job_start to close_cb). Is

Re: system() delay

2016-08-10 Fir de Conversatie Dominique Pellé
Ramel Eshed ]wrote: > Hi Bram, > > I noticed that using system() function has an overhead of 0.2 seconds > (checked on RHEL 5.5) while using job_start() is 10 times faster (from > job_start to close_cb). Is this because of system() is using temp files > instead of pipes? This is a noticeable

system() delay

2016-08-10 Fir de Conversatie Ramel Eshed
Hi Bram, I noticed that using system() function has an overhead of 0.2 seconds (checked on RHEL 5.5) while using job_start() is 10 times faster (from job_start to close_cb). Is this because of system() is using temp files instead of pipes? This is a noticeable delay. Thanks, Ramel -- --