59 points · by binarydreams · 14y ago · 37 comments
They know that too probably which is why their benchmark in the embedded slides is completely meaningless (just a simple hello world)
When you switch to C for the framework code, what you gain in speed, you lose in flexibility, customizability and ease-of-deployment.
That said, a quick look at their documentation shows a nice framework that doesn't enforce too much structure while still providing the necessities that plain PHP doesn't.
Yes, it's true that a simple request router will probably not add a lot of overhead, whether it came from a framework or was something you rolled yourself (there's only so many ways to parse a URL). The real overhead comes from the other stuff the framework does, and chances are the heavy lifting will be in an ORM and a couple helper functions with badly written regular expressions.
Disclaimer: I haven't looked at the code for this framework, but that's pretty common among all of them.
Granted it may well be good for common functions required in intensive background processes.
Such a benchmark, gives you a sense of how bloated/(or feature rich depending on your point of view) a given framework is, and also a rough view of the hardware resources (mainly RAM and/or CPU), which you will need to deploy a site based on it.
Thus said, it would be usefull for them to put a simple PHP baseline shown in the slides too.
With this you loose the flexibility and transparency of having the framework in PHP. There have been many times when I've had to go routing through Zend framework to really understand how or why to do something a certain way.
Routing is something Netgear and Cisco do.
Also there are a number of framework features you can't use with HPHP, like autoloaders.
Never tried it, but looks like a simplified Zend Framework.
[1] http://pecl.php.net/package/yaf [2] http://news.php.net/php.pecl.dev/9716
2. Saw lots and lots of static method calls
3. Closed page again.
This way of judging frameworks has never failed me.
* Lots of static calls are indicative of function classes - classes as namespaces for functions, and not a real OOP approach
There's nothing wrong with static calls per-se, but lots of them is a code smell in most cases.
In a language like Python, it's not uncommon to be far more discriminating about what is a class and what is just implemented using functions. That design is lost on PHP really.
*I disagree with the loathing. The backslash is a bit ugly but life goes on.
You can as of PHP 5.3 with late static bindings. `static::function()` will use the inheritance chain to find `function`
There is nothing wrong with a static call under a lot of conditions (not stateful, no override requirements etc).
The same people also tend not to complain about C paradoxically.
To be honest though I'd be more inclined to use PhalconPHP for its straight-forward no-bullshit documentation and real world examples rather than the fact that its written in C.
The frameworks are slow in places because of some of the techniques used to make development faster and easier - such as autoload. autoload is notoriously difficult to bytecode cache
It isn't a coincidence that the pitch here is against frameworks in PHP and not plain PHP itself. I'd like to see a benchmark against plain PHP, I bet there isn't much of a difference.
If you really need to optimize this stuff just go into your PHP framework and rip out autoload and any fancy reflection stuff (extract, eval). Put in straight include() or require(). Use PHP for templating or a templating system that compiles to straight PHP which is include()'d. setup APC..
Saves you switching development environment, retraining developers, increasing dev time and I bet the difference in benchmarks would be pretty negligible.
[0] http://www.yiiframework.com/doc/guide/1.1/en/topics.performa...