-
Notifications
You must be signed in to change notification settings - Fork 179
Optimize ps termlet. Runs in ~1.3sec instead of ~2sec on an AMD E-350. #340
Conversation
This might also fix #328. |
ps "$@" | | ||
|
||
while IFS= read -r line; do | ||
# Position of string "PID" in line | ||
pid_index=$(awk -v a="$line" -v b='PID' 'BEGIN{print index(a,b)}') | ||
if [ $lnnb == 0 ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if this if
block header followed the style of the one below. Also note http://stackoverflow.com/questions/669452/is-preferable-over-in-bash-scripts, though it shouldn't matter much here.
OK, I’ll rename the var. I’ll take a look at merging tests too. |
… on an AMD E-350.
…lets Conflicts: data/Termlets/ps
Opened an issue for "ps e" case. See #342 . Have rewritten ps termlet. It’s now even faster (and more commented) than the first changes, runs in under half a second :) |
dir_end_mark=$(text_menu_end '2') | ||
file_begin_mark=$(text_menu_start '1') | ||
file_end_mark=$(text_menu_end '1') | ||
#index=0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good optimization, with zero undesirable side effects. It seems to me that all the commented lines above are unrelated and unnecessary though. Could you please remove them?
OK, here we are (I hope) : |
Thank you, this looks and works great. Merged! I have added your name to the about dialog credits. |
My pleasure p-e-w :) |
No description provided.