4 ms·
PHP isn't that bad for production performance, if you have the right mindset. Another way of saying PHP has to bootstrap everything on each request (which is a
by toast0 6y ago
PHP isn't that bad for production performance, if you have the right mindset.
Another way of saying PHP has to bootstrap everything on each request (which is a bit of an overreach; it doesn't reload C libraries, and you can do opcode caching and data caching, etc), is that PHP throws away everything you've done after each request.
That means everything that you build that isn't output somewhere is garbage.
If you spend a lot of time making a sculpture out of garbage, only to throw it away, you'll have poor performance. If you use the minimum of scaffolding to send out the bytes you want to send, you can get pages (or api responses, whatever) with a few ms of overhead in addition to your underlying data fetches. You could certainly go faster with something else, but PHP can be decently fast.
On the other hand, your code won't look at all like what people think of as 'modern' PHP.