You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm using your library in a parallel stream and I have some performance issues: the average duration of a command is longer in parallel than in sequential.
The problem seems to come from the creation of the executor service in PowerShell#open().
A possible solution would be to put PowerShell in some kind of pool. Therefore, the ExecutorService should be injected instead of beeing creating directly.
After some digging, I have found that ExecutorService is not the main problem.
A small part of the slowness comes from PowerShell#open() and a big one comes from the first call to PowerShell#executeCommands(String[]). Subsequent calls are really cheaper.
That sounds like something the PowerShell process or the Java process API does on the first command. Usually it's pretty cheap to just leave the PS session open if you need to use it multiple times. Feel free to report back if you find something new, but I'm not interested in further investigating this.
Activity
charphi commentedon Sep 12, 2018
After some digging, I have found that
ExecutorServiceis not the main problem.A small part of the slowness comes from
PowerShell#open()and a big one comes from the first call toPowerShell#executeCommands(String[]). Subsequent calls are really cheaper.Tuupertunut commentedon Sep 14, 2018
That sounds like something the PowerShell process or the Java process API does on the first command. Usually it's pretty cheap to just leave the PS session open if you need to use it multiple times. Feel free to report back if you find something new, but I'm not interested in further investigating this.