5
lopu
3y

thank me later

deprionode() { for f in $(pgrep 'node'); do renice +20 -p $f; done ;}; export -f deprionode
prionode() { for f in $(pgrep 'node'); do renice 0 -p $f; done ;}; export -f prionode

Especially if you run a MacBook pro

Comments
  • 2
    Coolio. Why not bump it down all the way to -20 and 19 respectively?
  • 2
    Can I ask what this does?
  • 2
    @Ranchonyx Every node task (pgrep - pids of process(es) with name node) gets a higher scheduler priority.

    -20 - scheduler prioritizes highest (best)
    0 - default
    +20 - scheduler prioritizes lowest (worst)

    Though the code is wrong.

    No validation of error code. Meaning that it's not guaranteed that the priority was actually changed at all.

    It can make sense when you have a fuckton of open applications as for some reason you don't like closing applications - the scheduler then prioritizes the process with the lowest priority.

    Though this doesn't need to be a good thing.

    After all, we're talking just about scheduling here (CPU)
  • 0
    @IntrusionCM this is interesting actually. Node is strange.
  • 1
    @Ranchonyx

    Resource hungry, mem hogging piece of shit.

    While there is a difference if it's just CPU usage, as soon as e.g. I/O is the bottleneck it doesn't do much.

    I'd consider it an "pseudo" optimization at best... Relevant maybe for desktop, but even there limited just to the CPU scheduling.
  • 0
    I've been using on my new M1 powered MacBook pro for work, my computer used to slow down a ton on rebuilds of yarn projects, even my music would start playing choppy, but since lowering the priority of node processes it doesn't interfere with my other programs, the whole computer doesn't slow down which is great
  • 1
    I like the :}; emoticon. (Don't know if the ; counts)
Add Comment