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
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
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
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())
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')
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
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
> > That's exactly what I've did:
> > > > > > > > >
> > > > > > > > > func! Job()
> > > > > > > > > let s:rt = reltime()
> > > > > > > > > let g:output = []
> > > > > > > > >
> > > > > >
> > > > > > > > That's exactly what I've did:
> > > > > > > >
> > > > > > > > func! Job()
> > > > > > > > let s:rt = reltime()
> > > > > &
> >
> > > > > > > That's exactly what I've did:
> > > > > > >
> > > > > > > func! Job()
> > > > > > > let s:rt = reltime()
> > > > > > > let g:output = []
> > >
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
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
> > > >
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
> > &
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
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
;""""""""""
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
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
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
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
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
--
--
20 matches
Mail list logo