PhalconPHP - High Perf PHP Framework as a C Extension
phalconphp.com
phalconphp.com
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.
If your data store structure and queries (SQL or otherwise) are designed to perform and scale, you can get in and out very quickly (milliseconds or less), after which you'll spend most of your time turning the data into something useful.
(That's even before we talk about caching so you don't have to talk to the data store at all...)
Facebook didn't write HipHop (and reduce CPU utilisation by 50%) because their database queries were slow!
A bottleneck is something you get when you have multiple concurrent actions and one of them is slowing down the actions of the others. No matter how fast the other actions get, the slowest one is the bottleneck.
Framework overhead is not a bottleneck at all, it's just overhead. If your framework takes 10ms to load, it doesn't matter if your database is taking 200ms or 2ms to return it's result, you still pay the extra 10ms for the framework loading. This is because the 10ms is not concurrent with anything, you just pay it at the start regardless.
Now you can argue that the 10ms is not significant when compared to the 200ms your spending in your database, but this is an entirely different kind of argument.
Granted it may well be good for common functions required in intensive background processes.
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.
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.
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.
* 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.
You can as of PHP 5.3 with late static bindings. `static::function()` will use the inheritance chain to find `function`
Example
MyClass::func();
func() Is tied to MyClass. if you extend it, you will have to hunt down all of those calls and replace it
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.
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...