performance - Running Powershell script via Runspace from C# is very slow -
when executing particular script powershell command window, execution takes 2 minutes. executing same script c# (windows service) using system.management.automation.runspaces takes 5 6 minutes! spawning new powershell.exe process service makes time drop 2 minutes again.
i noticed cpu usage higher when using runspace.
unsurprisingly, time spent in pipeline.invoke(), doesn't make debugging problem easier.
the script use complex , whole bunch of stuff, it's not easy pin down issue. how can narrow down problem?
is there obvious may missing?