neekey / ps

A Node.js module for looking up running processes
MIT License
128 stars 41 forks source link

Performance issue, blocking the main loop, using too much CPU #85

Open emcodem opened 1 week ago

emcodem commented 1 week ago

The execution takes about 5 seconds, it spends nearly all the time in ConnectedDomain function from table-parser module. ConnecteDomain function seems to be extremely CPU intense, so much that it even blocks my main loop for a few seconds.

Code:

var ps = require("ps-node") 
ps.lookup({ pid: 0 }, function(err, resultList ) {
    console.log(resultList)
});

There are about 400 processes in the returned list, so pretty small string to parse, i am sure it can be done in fractions of a milliseccond. Please let me know if you need more info, the issue feels to be so general to me that i don't know what else to say than i am on windows.

emcodem commented 1 week ago

oh sry, i didnt notice this repo is dead, btw it also used about 400m RAM for this simple task, i call the wmic commandline myself now and regex the result, all finishes within a few milliseconds