Closed rany2 closed 4 months ago
I came across this:
https://lobste.rs/s/1l1t8f/bash_functions_are_better_than_i_thought
With some functions like log_msg() there are conditionals that are repeatedly (and unnecessarily) reevaluated. It might be beneficial to either (re)define the functions based on the conditionals on the initial script load and/or leverage formulations like ‘${function} argument(s)’ in which the function is changed in dependence upon the conditionals.
@lynxthecat I've thought of this actually but got lazy. I'm not sure how beneficial it would be to do this but I could look into it
Very nice changes! I am seeing more frequent and more prolonged dips down to 6% total CPU usage on my RT3200 now (as measured using atop 2
and hitting p
):
The below changes reduces CPU usage by 0.5% on my X86 machine:
Switch to using
:
instead oftrue
as it is consistently faster in the below benchmark, unsure why as they are both noops:Switch to switch case for the idle/sleep function handling code.
Remove unneded non-empty string handling check