3 ms·
And communicate with it how? If you’re suggesting spawning things over shell/cmd line I’m of the opinion that this a generally bad idea.
by FridgeSeal 7y ago
And communicate with it how?
If you’re suggesting spawning things over shell/cmd line I’m of the opinion that this a generally bad idea.
- sfkdjf9j3j 7y agoWhat's wrong with forking and using a pipe or socket?
- kccqzy 7y agoJust fork and exec. Or if you fancy, posix_spawn a separate process. Then communicate over pipes, or if you have a lot of outputs from these tools, collect results from the file system. Really, where does this fear of spawning things come from?
- jononor 7y agoPython module loading tends to be quite slow. Loading Tensorflow on our Heroku production environment takes 10 seconds (5 on my laptop). A client of mine running Rust and Python on Embedded Linux device found that loading numpy/pandas modules took over 5 seconds (laptop was under 1), and their computation took just x00 milliseconds. 10x overhead... So the spawning of a short-lived subprocess approach has massive overhead, only suitable for multi-second workloads.
- umanwizard 7y agoSpawning an external binary does not necessarily involve the shell (if it did, how could the shell itself spawn things? It’d be shells all the way down)
- zetalemur 7y ago> And communicate with it how? The simplest approach is via a pipe to the process' stdin/stdout I guess. Of course you have to (de)serialize your data, but you would have to to the same if you go the HTTP route, which seems far more complex. Furthermore the suggested solution probably has a nice wrapper in the language's stdlib (e.g. `check_output()` in Python land).