I understand from PHP exec() performance that running exec() creates an overhead but in large programs or websites, wouldn't it be beneficial to have parts of the backend written in another language, and have PHP call the program using exec?
For instance, I wrote/ran a test with a large amounts of string manipulation - PHP took 2.3s while Java took .52 and C++ took .33. The speed difference is already obvious. The time could be sped up even more if I multithreaded the operation. I also found that parallelism can be achieved in with something like
exec("./largeoperation > mydir/$dirname.data &");
//or
exec('java Backend > /dev/null 2>&1 &');
With all these benefits, other than the need to write code in another language, I fail to see why I shouldn't relegate more parts of my backend to a faster program written in a different language. Also, I know of the existence of bridges like Working with Php-Java Bridge but I'm not sure if using that would be THAT much faster than simple exec(). Does anyone have any more details on exec()?