Yeah, you need to take into account what switch cases are for. The compiler in python can't really optimize it due to how it works, so not really needed for performance. The only thing I miss about it is the fact that I can better structure code, which the example I posted allows me to do.
I used it to match users' state to a function call, so if they disconnect I can know what they were currently doing and resume at the same state. Was a problem with the framework I was using (and yes, I was using python specifically due to a ML package). Ended up being easier to write it in Java as the framework was more feature rich/less buggy there and using a webhook to do the ML heavy lifting when needed. Was my specific use-case though.
EDIT:
as a side note, do note benchmarks will be a bit different to real world.
Python 3 has a large cost to call for the first time/initialization, and then it will stay in memory and be low cost for any subsequent calls.
PHP will pay for every initialization. Again, both can be tweaked to be like the other in the way they handle it, but for most use cases you won't really see too much difference between PHP and Python.
PHP has not been slow since PHP 7 (and I could even argue PHP5).
Your use case will define your choice, e.g. in PHP I can't start multiple threads to parallelize something unless you hack it, then python would be better.
As an aside, anything but Node.JS
These are about java vs PHP vs Node vs Go, but again, this is not really apples to apples, each language has its strengths.
https://www.toptal.com/back-end/server-side-io-performance-node-php-java-go
Do note in the above for some reason the dude used PHP5.4 and not PHP7. It will beat Node in every single one of these tests.
If you follow that, we should all move to Go, but if team is more familiar with Java, why not go for that?
A lot better a benchmark is this:
https://www.techempower.com/benchmarks/