Do emacs command lines run much slower? How can I prevent this, but still use it?

Today I ran a command like this in the emacs shell:

./someBinary | grep foo | cut -c30- | sort | uniq -c 

which in bash takes a little but not so long (about 15 seconds), because the output is more than a million lines. However, when I ran this command in the emacs shell, I waited more than an hour and still worked, while the processes worked noticeably if I checked with top . I wonder if this happens because emacs implements the unix tools I am connecting to in lisp - and if this is the reason if there is a default way to use the system ones.

+4
source share
3 answers

Emacs writes the final output to the shell buffer and applies font lock and other analysis (such as counting the number of lines) to display it. It also scrolls the display to display the last result. While Emacs has conditions for rejecting a pathologically long command output, it is not optimized for really huge amounts of output in millions of lines, so it is noticeably worse than your terminal emulator, slowing down the entire pipeline.

If you are not interested in exiting, redirect it to /dev/null or tail -500 , which you can see in a typical terminal scroll anyway.

+3
source

no, emacs does not implement these tools. which launches the same tools that you run from the command line. however, the output is transmitted through various channels and probably has different formatting used by emacs, which is most likely the culprit of the extreme slowdown. One simple task is to disable the font lock mode in the shell buffer.

+2
source

You are not saying whether you are eshell or shell . In my experience, the shell works just fine, but eshell completely unsuitable for anything that wants to put> 1k lines through the pipe (which is sad because the other eshell functions look pretty good).

Note. eshell is slow, even if the output is only one line, if you use | , so it seems to be the actual operator | (which is implemented in emacs-lisp in eshell), which is slow.

0
source

Source: https://habr.com/ru/post/1443339/


All Articles