mprocs icon indicating copy to clipboard operation
mprocs copied to clipboard

High CPU usage when there is a lot of output

Open niveK77pur opened this issue 2 years ago • 1 comments

I discovered this program today and I love it! It's just absolutely perfect at what it tries to do.

I did notice though that mprocs seems to struggle a bit when there is a lot of output from a process. I don't notice it stuttering but I definitely see it creep up the list in top, reaching above 80% usage (up to 100% and more in fact).

Here is one way to reproduce it.

mprocs "find /"

Another clarification. The CPU usage is only high, when I view a process with a lot of output. If I have another one selected that doesn't spit out a lot of information, then everything seems fine. Try the following and see how CPU usage changes when you select either process.

mprocs "watch date" "find /"

If I run find / directly in my terminal (I tried alacritty and xfce4-terminal) then CPU usage seems to hover between 20% to 30%. Not sure if this is something that can be fixed, but I'm putting it out here just in case!


Random ramble ahead

Before you ask why am I running such useless commands: I am actually working on a latex document on Overleaf and I compile it locally by git pulling it. However, compiling latex is very verbose and spits out a ton of information rather quickly. If I didn't have to collaborate, I wouldn't use overleaf, and then I would fall back to vim with vimtex which hides all of the compilation output from me.

The nice thing with overleaf is collaboration. But when there are people working on the document, I cannot pull and push it using git because the push will be rejected (since people are modifying the document as I push it). I still prefer to compile the document locally however, so I git pull in one terminal, and have latexmk -pvc run continuously in another terminal. This will have latexmk automatically recompile when it detects any changes.

In other words, when I want to recompile, I simply pull the changes, and it will trigger recompilation. With mprocs I set up a config file, so now I can very quickly get this setup up and running in a really tidy manner :grin: Essentially one process is running latexmk, the other is running git pull which I restart when I want the new changes from overleaf.

niveK77pur avatar Jul 02 '22 21:07 niveK77pur

Thank you for the detailed explanation and I'm glad mprocs is helping you.

I think it's possible to improve rendering performance of mprocs by rerendering more rarely when output goes very fast. I implemented rendering in a straight forward way without employing any performance tricks. I think I should take another look at performance as more people are using mprocs.

pvolok avatar Jul 03 '22 12:07 pvolok