I think how you design your code and what software architecture you use has a larger impact on your performance than the underlying language. In my opinion programmers and software architects make software fast or slow. Ruby and PHP are both interpreted languages which can make code slower than compiled code because a compiler does certain optimizations. But for both PHP and Ruby there exist bytcode caches and compilers.
Answer from Martin Fahl on Stack OverflowMy network is biased towards rails, so all the php people I know prefer rails. PHP is more popular on the stackoverflow dev survey, and I’d like to know why people prefer it (and its frameworks) over ruby/rails.
Is ruby Slower than Php in performance benchmarking - Stack Overflow
PHP/Laravel vs Ruby on Rails. Which one is more worth learning now?
Switching from PHP to Ruby - is it the answer to performance? - Stack Overflow
Ruby or PHP Worth Learning? : r/cscareerquestions
Videos
I have interest in both of these languages / frameworks. So far I'm proficient in frontend but need a backend with my React projects. What I mean by worth learning, is which is more popular / widely used in companies? I've seen job listings with either or both. So I can't really tell from that standpoint. Asking people with more experience in the industry than me.
Also, what would you prefer and why? (This is more of a subjective question)
Changing your programming language from one to another isn't going to result in massive performance increases or losses. Changing the way you write code is more likely to have much greater effects.
There are tons of good reasons to switch from PHP to Ruby. Performance is not one of them. Some of the largest sites on the web use PHP. It's perfectly capable of performing well if you use it right.
If working on a high-performance application, there are many things to consider when optimizing for speed:
- Where are your bottlenecks? At the database or application level?
- Are you using caching to speed up requests?
- Can you get a performance boost via load balancing or separating the database server from the web server. Hardware is cheap, programmers are not.
- Consider using a performance optimized language on the back end, but keep using PHP on the front end.