-
-
Notifications
You must be signed in to change notification settings - Fork 339
Async processes use a pty instead of a pipe #1822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the info. I can reproduce the 10x speedup for I've done some debugging. For the above use case:
Basically with By the way, that branch of A significant speedup would be to call An even more significant speedup would be to rewrite the logic so that |
For
Okay, but
Sure, so long as care is taken when joining potentially incomplete lines (process filters can receive input of arbitrary size).
Either way, I think it's more important to fix the |
Looks like it's a bug with either Emacs or
|
Ha, (See #1800 for an issue with |
This comment has been minimized.
This comment has been minimized.
I think it's worth to apply the change proposed by @basil-conto as all issues associated with it seem to be resolved. |
FWIW, I tried the change proposed in the original message and it broke ripgrep for me on linux. But ag worked fine and was much faster under the same test. 🤷♀ |
I think that's due to how Emacs starts subprocesses in conjunction with |
The same thing happens with The difference being that |
Commit 9414f7a made me realise that asynchronous Counsel processes like
counsel-ag
andcounsel-rg
use a pty, rather than the more efficient pipe (see(elisp) Asynchronous Processes
and #1759). I don't think any Counsel functionality relies on pty features, so I think we should work towards switching to pipes wholesale.I tried the following change on top of PR #1821:
This decreased the time it takes for
counsel-rg
to find 47690 occurences ofcons
in the Emacs source tree from ~20s to under 2s. Unfortunately, it also completely breaks many other users ofcounsel--async-command
, such ascounsel-ack
andcounsel-ag
. In these latter cases, no results are shown whatsoever.I'm not sure, but my gut instinct tells me this may even be an Emacs pitfall/bug pertaining to
while-no-input
and/orpselect(2)
. This is because various intricacies with asynchronous process output have been reported over the last year, e.g.:bug#33018
What I'm even less sure about is why
counsel-ag
et al. suffer from this, butcounsel-rg
doesn't.I thought I would open this issue to see if anyone else notices the same behaviour, to discuss switching to pipes in general, and perhaps even to spark some interest in the underlying bug(s).
The example above was tested with latest Ivy and Emacs:
The precise steps I took were:
make compile
emacs -Q -l colir.elc -l ivy-overlay.elc -l ivy.elc -l swiper.elc -l counsel.elc -l targets/plain.el
(cd source-directory)
RETcons
The text was updated successfully, but these errors were encountered: