❔ Improving performance for Process.Start
I have an application that will run a python script using Process.Start. At the end, I'm reading the output with
process.StandardOutput.ReadToEnd()
. If I run the script on it's own, it runs in about 1 second. But running it this way takes about 2 seconds. Is there any way I could reduce some overhead? Is reading output time consuming?9 Replies
Maybe a pipe would be faster?
maybe make the script write the output to a file?
and then read the file
I can give it a shot. I assumed that would be slower, but it wouldn't take long to test it out
u could use IronPython and execute the python script directly in ur dotnet process
for a quick start guide u can use this SO answer https://stackoverflow.com/questions/41064961/how-to-use-python-in-net-core-application#answer-61891763
ipy can be much slower than even cpython for what it’s worth
unless you want to do some complicated interop i would not do it
if reading from stdout works then it is not complicated
Without seeing your code, this is the best suggestion I can offer you
https://stackoverflow.com/questions/4291912/process-start-how-to-get-the-output
Stack Overflow
Process.start: how to get the output?
I would like to run an external command line program from my Mono/.NET app.
For example, I would like to run mencoder. Is it possible:
To get the command line shell output, and write it on my tex...
Using asynchronous data streams may be your fastest choice, but it can be annoying to set up.
it's also lagging significantly behind cpython iirc
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.