News for hackers. Stuff that matters.
Re:Web Framework Benchmarks Round 4 by showerst on Thursday May 02, 2013 @11:42AM (#5645216)
Not that PHP is particularly fast, but I notice that Raw PHP does about middle of the pack, but all of the ORM versions seem to do terribly. Interesting stuff.

I've usually had pretty good luck with Slim, I'll have to try a version with & without redbean and see how big a difference it makes.

Re:Web Framework Benchmarks Round 4 by cmircea on Thursday May 02, 2013 @11:43AM (#5645220)
Probably because all those big frameworks have to initialize everything for every request. Parsing, connections, configuration, you name it.
Re:Web Framework Benchmarks Round 4 by showerst on Thursday May 02, 2013 @11:47AM (#5645253)
Yeah, of course.

With slim in particular I notice that the benchmarks list it as "Raw database connectivity" but in the code it looks like it's using RedBean ORM. I'll look more at lunch, i'm probably just misreading something.

Although obviously ORM is more realistic, since if you're sophisticated enough to be using composer and a framework, you're probably using an ORM. I know the point of this benchmark is frameworks not ORMs, but it would be interesting to swap them out and see if there's a huge difference.

Re:Web Framework Benchmarks Round 4 by notJim on Thursday May 02, 2013 @12:55PM (#5645722)
Raw php also has to initialize connections, and it does really well, so I don't think that's it. To me, that points to overhead from initializing the objects as the bottleneck. I would have thought that with APC, this wouldn't be a major issue, though, so I wonder if that's still not it.
Re:Web Framework Benchmarks Round 4 by cmircea on Thursday May 02, 2013 @04:40PM (#5647088)
APC only caches the opcodes, so the interpreter doesn't have to parse your code. But the framework still has to set up itself for each request individually. Parse configuration, create objects, etc. It adds up quickly.
Re:Web Framework Benchmarks Round 4 by egeozcan on Thursday May 02, 2013 @03:09PM (#5646517)
I always hear this myth that php gets very slow when you write proper OO code. I neither write nor maintain any php code so I wouldn't know.
Re:Web Framework Benchmarks Round 4 by oberhamsi on Thursday May 02, 2013 @01:21PM (#5645903)
Is there no php environment with a persistent server? Are they really all doing per request startup?
Re:Web Framework Benchmarks Round 4 by Joeri on Thursday May 02, 2013 @03:42PM (#5646692)
Yes. The PHP process keeps running but resets completely on every request. The bytecode is cached though, so loading the code shouldn't add much overhead.

PHP can be used for long-running jobs, but it doesn't have very good garbage collection, and has no language-level concurrency and very little asynchronicity.

Re:Web Framework Benchmarks Round 4 by rorrr2 on Thursday May 02, 2013 @05:27PM (#5647308)
Well, you could daemonize a PHP process, which would listen to some port, and parse the requests. It's like implementing your web server in PHP.

The problem with it is, one request can bring the whole thing down.

Re:Web Framework Benchmarks Round 4 by coldtea on Thursday May 02, 2013 @11:50AM (#5645266)
Actually, as soon as a lot of db connections are involved, PHP jumps to the head of the pack.

Which means that in most common web use cases (which are db heavy), PHP is as fast as any of them, since all the slowdowns (initialization, slow Zend engine etc) are dwarfed out by the fast db handling.

Re:Web Framework Benchmarks Round 4 by krg on Thursday May 02, 2013 @11:56AM (#5645322)
Raw PHP (with no framework, no ORM) does well in the 20 query test, but unfortunately you have to go down pretty far before any of the PHP frameworks show up on that list.

If I filter to just show PHP, the 20 query test shows that the first framework is less than 50% the performance of raw PHP.

Re:Web Framework Benchmarks Round 4 by showerst on Thursday May 02, 2013 @12:19PM (#5645474)
Looking into the code, the raw PHP is using PDO with persistent connections, and I'm not sure that's turned on in any of the frameworks.

It looks like it's off by default in Redbean at least. No idea if this makes a big difference, I haven't had time to try it out.

Re:Web Framework Benchmarks Round 4 by Joeri on Thursday May 02, 2013 @03:50PM (#5646746)
Yes, it does look like none of the frameworks are using persistent connections, which would explain the horrible performance. To be fair though, it is still a valid measurement if the frameworks don't enable persistent connections by default.
Re:Web Framework Benchmarks Round 4 by Schlaefer on Thursday May 02, 2013 @04:47PM (#5647130)
> it is still a valid measurement if the frameworks don't enable persistent connections by default

I don't agree. Frameworks often prefer the "safe" option over "performance" by default. If you activate persistent connections by raw coding it [1] then you should also set an absolutely obvious database configuration flag like [2] in a framework.

---

[1] https://github.com/TechEmpower/FrameworkBenchmarks/blob/mast...

[2] https://github.com/TechEmpower/FrameworkBenchmarks/blob/mast...

Re:Web Framework Benchmarks Round 4 by fein on Thursday May 02, 2013 @11:47AM (#5645249)
If their FAQ's page is saying what I think it does, then they aren't testing with memcache or opcode caching.

Also no love for Yii.

Re:Web Framework Benchmarks Round 4 by krg on Thursday May 02, 2013 @11:49AM (#5645265)
We are using opcode caching.

"PHP 5.4.13 with APC, PHP-FPM, nginx"

http://www.techempower.com/benchmarks/#section=environment

We've had a lot of input from the PHP community about setting up the PHP tests properly, but if you have a suggestion for an improvement we'd appreciate it.

Memcache isn't used because none of the tests are caching database results. A later test will use caching.

We'd be happy to include Yii. Submit a pull request. :)

Re:Web Framework Benchmarks Round 4 by redtuesday on Thursday May 02, 2013 @04:18PM (#5646951)
Someone mentioned the benchmark in the Yii forum a while ago [1], but it seems nobody wanted to submit a pull request for Yii.

[1] http://www.yiiframework.com/forum/index.php/topic/42168-fram...