I need to send a string from C# to a Python script, have the script do some magic, then return a string. This needs to happen ~million times. Right now i'm doing the communication just using STDIN/STDOUT, but it's very slow. I did a quick testing comparing IronPython vs this approach and it was orders of magnitude faster.
The only way I can think of to fix this is to instead of sending over one string at a time to Python, write all the strings to a file, then have Python read the entire file in and write back values to a new file. While I assume this would work, it would require a decent amount of changes to existing code to support sending over all the values at once.
Is there some faster form of communication I can use between C# and Python? One annoying catch here is that this needs to support any version of Python (2.7, 3.0, IronPython etc etc).