File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -29,9 +29,27 @@ const preferNotMatching = matches => (a, b) => {
2929const deprioritizedProcesses = new Set ( [ 'iTerm' , 'iTerm2' , 'fkill' ] ) ;
3030const isDeprioritizedProcess = process_ => deprioritizedProcesses . has ( process_ . name ) ;
3131const preferNotDeprioritized = preferNotMatching ( isDeprioritizedProcess ) ;
32- const preferHighPerformanceImpact = ( a , b ) => numSort . descending ( a . cpu + a . memory , b . cpu + b . memory ) ;
3332const preferLowAlphanumericNames = ( a , b ) => a . name . localeCompare ( b . name ) ;
3433
34+ const preferHighPerformanceImpact = ( a , b ) => {
35+ const hasCpu = typeof a . cpu === 'number' && typeof b . cpu === 'number' ;
36+ const hasMemory = typeof a . memory === 'number' && typeof b . memory === 'number' ;
37+
38+ if ( hasCpu && hasMemory ) {
39+ return numSort . descending ( a . cpu + a . memory , b . cpu + b . memory ) ;
40+ }
41+
42+ if ( hasCpu ) {
43+ return numSort . descending ( a . cpu , b . cpu ) ;
44+ }
45+
46+ if ( hasMemory ) {
47+ return numSort . descending ( a . memory , b . memory ) ;
48+ }
49+
50+ return 0 ;
51+ } ;
52+
3553const preferHeurisicallyInterestingProcesses = ( a , b ) => {
3654 let result ;
3755
You can’t perform that action at this time.
0 commit comments