The weird thing is that they don't have to be bloated. There's just a lot of 'well, that's how we've always done it' or 'some guy said this is best practice' in frameworks. There's also a lot of programming practices inappropriately imported from Java that add to this bloat.
PHP is just C in a suit. Object oriented functions are slower and use more memory.
The trick of C++ 'Zero Cost Abstractions' is a very CPU-expensive compiler that, at any given opportunity, breaks your object oriented code into basic functions and variables. You pay during iteration time, not execution time. Not a bad trade.
But PHP can't do these tricks. You pay for objects in runtime. You also pay for the virtual monolith that gets built up and destroyed in frameworks like Laravel. In Java, we boot our monolith once. In PHP, not so much.
In 2020 i evaluated whether i want to keep programming in PHP. I didn't like the culture or ecosystem anymore. It all got so bloated and overly complex. This made programming very un-fun for me.
It lead me to read the writings of John Carmack and Rasmus Lerdorf, the inventor of PHP.
I formed a thesis: what if you write a framework in PHP around the underlying language? We can't really ditch object oriented entirely. But with a light OOP approach, it could be feasible to make PHP go brr.
And also while we're at it, let's apply all the John Carmack wisdom about C, if that's what we're interacting with to a good degree.
The first thing i built was a mini-profiler and debugger that would measure what the framework was doing. This way, i could could quickly prove/disprove my thesis. With this tool, i was able to optimize the core of it before anything else to see what the full potential looked like.
View attachment 341017
The performance result was, and still is hard to believe at times. And even stranger that we weren't paying for modern conveniences.
For this reason this thought experiment became something my company has been building on for the last 5 years.
Through this experience, i learned that PHP is a very cool language. If you know how to massage it, it can do a decent impression of a lower level language. You get that and a sizeable reduction of work the programmer needs to build a web app.
View attachment 341014
Go is a good language, and the web libraries for it are well developed. The concurrency features are very nice. But still, that tool doesn't fit in the hand like PHP does if you are building a web app. We now have a bunch of icky low level stuff to do, and we also lose many of PHP's superpowers. For me, it'd be hard to give up PHP because i like the have your cake / eat it too factor too much.
Thanks for coming to my TED talk.