-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting tasks is slow #4
Comments
I don't see any particular time consuming task in the code other than running |
Here is what the code looks like. While a lot of the code below isn't directly relevant to this module. The first two console logs returned under a second. But the console log inside the task list callback takes over 7 seconds. If I remove the tasklist code completely and just run everything else, then the whole block completes in about 2 seconds. So the tasklist callback is where the delay is happening... so it seems like it's slow to get the list of tasks....
|
It feels like this is related to your code somehow. Just running this takes const tasklist = require('tasklist');
tasklist().then(data => {
console.log(data);
}); |
Probably not the issue, but you're working with an older version of |
@kevva it took about 3-4 seconds when I ran you code on its own inside from the command prompt. So it seems it's taking longer on certain machines than others. However it's still much quicker than when I run it inside my Electron app. I wonder if NodeJS modules run slower from Electron... @SamVerschueren I tested this with the new version and it's the same. |
How long does running |
@kevva About .5s So in short I have this happening: Native call: .5s It's still much slower when running the NodeJS version compared to the native.... So wonder if that's the issue and when running it inside Electron it just doubles up that time. |
That's really weird. Spawning comes with some overhead, but that should be 30-100ms, not seconds. I would recommend you create a super simple spawning Node.js example executable that just spawns tasklist.exe, nothing more, and open a Node.js issue if it's still that slow. |
@sindresorhus Could you provide a quick example of exactly that so I can test if that is also slow. Unless you literally mean |
I literally mean that. |
@sindresorhus So this?
|
@iamdriz No, the same as this module. childProcess.execFile('tasklist') |
@sindresorhus Okay I have done that, but it just executes immediately and nothing is returned... Is this correct?
|
How long does it take to run? |
@kevva It's pretty much instant. |
@SamVerschueren Again, this takes like 1 second. So not sure why tasklist module is taking 2-3 seconds longer and then when run inside Electron a further 4 seconds. So to clarify: This takes about 3 times longer:
than this:
So there is serious overhead with the module approach over the native call. But when this same code is run inside Electron it then takes even longer, nearly doubling it. |
Closing for the same reason as electron/electron#4020 (comment). |
I'm using this module in an Electron/NodeJS powered application that can open other exe's.
I use it to see if the exe I am trying to open is already running before opening it again. However it can take this module up to 7 seconds before the tasklist has returned. Adding this to 2-3 seconds for the exe to be called/launched it causes applications to take up to 10 seconds to be launched. Is there any reason for the lag? Or ways it could be sped up?
The text was updated successfully, but these errors were encountered: