microsoft / node-pty

Fork pseudoterminals in Node.JS
Other
1.43k stars 232 forks source link

Delay between stdout output and data event fired #529

Closed justablob closed 1 year ago

justablob commented 2 years ago

Environment details

Issue description

It seems like sometimes, there is a delay between the child writing to stdout and IPty.onData being fired. For reference: I observed this behavior while writing a libinput gestures client for Linux. Opening libinput debug-events in a normal terminal gave me immediate stdout output, while sometimes, the output from node-pty is lagging behind a few hundred milliseconds. It is miles better than child_process buffering, but still leads to noticeable delays.

Tyriar commented 2 years ago

I haven't observed this, I don't use Linux much these days though. Next steps here would be to try launching the node process in question with --inspect, connecting chromium and getting a performance profile to see if there was something else blocking the main thread:

image

sedwards2009 commented 1 year ago

I upgraded the node-pty version I was using a month or two ago and there was a noticeable improvement in latency for plain interactive use.