Robert Audi
Robert Audi

Reputation: 8477

Are Symfony and CakePHP too slow to be usable?

Until now, I have always said that CakePHP is too bloated and slow. I don't really know that, I just saw "some" benchmarks. What I really want to know, is that if those two frameworks (Symfony and CakePHP) are too slow to be usable in a way that the user will get frustrated. I already know that those frameworks are slower than other alternatives, but that's not the question.

I ask the question because I want to create a project management web application and I still hesitate between a couple frameworks. I've had some trouble learning Zend, but imho I haven't tried hard enough.

So in conclusion, in addition to the first question above, I would like to ask another question:

If I want to create a project management tool (which is a pretty big project), which of the following should you suggest, considering the developement time, the speed of the resulting application, and the robustness of the final product:

Also I should mention that I don't know any of those frameworks, and that I want to learn one of them (at least).

Upvotes: 16

Views: 5874

Answers (5)

Marius Gri
Marius Gri

Reputation: 59

Symfony is intended to be slow, if you look in lifecycle of request and how results get serialized, any customization has great impact to performance, but this is also due to general objective programming. You cannot have entities as objects and expect it to work fast. Symfony quite succeeded in making entities serve only one purpose, being reflection of entry, yet they didnt use that advantage to increase performance. As every entry is being constructed and going through all "guessing" regards serialization/normalization routine for each entry, and even worse when it comes to the need of custom data which leads to transformers or RSM or what not, at the same time not taking advantage of context concept that they use which could minimize the query count when it comes to doctrines unit of work. Generally in php, for apis to serialize data fast - entry must not be instantiated as object and only entities description should be used then generating output. It would take quite tremendous work to make api on symfony run fast while following its principles and no one seems to work towards it. Otherwise you can do as with other frameworks, in this case only using DQL, writing your RSM and making your own "apiplatform" project on top of the project youre working on. This solution however would only work out for api-only backend project tho as you would end up having array outputs. Altho the latter thing affects vast majority of frameworks.

Upvotes: 0

Benoit
Benoit

Reputation: 3598

Frameworks generally aims to better code organization, reusability of components, testability, and to generalize, application quality & maintenability. This can not be the more performance oriented choice.

I got sites running with symfony that are pretty fast, the benchmarks comes close to the original static HTML template.

Performance issue could happen more quickly when using a framework (and an ORM like Doctrine) than when putting spagetti code inside an HTML static page. That's sound normal to me : more treatements, more verifications, mode dependencies, more code to parse, etc.

If you mant to make application faster, they're is basically to ways :

  1. Get faster hardware, it costs, but can be worth it if this cost is under programmers & engineers cost, which is generally the case.
  2. Optimize software, the bigger step to this way is to use caching on multiple level : opcode, database query results, any heavy objects, html rendering (partial and whole).

With a well designed MVC application you can manage performance as an isolated issue, using profiler to views application's bottlenecks and treat them one by one (once again, optimization can be on hardware side too).

The choice of a PHP framework should not be made on various performance tests seens on blogs arcticles, they can not be objective. From my point of view, all major MVC frameworks can be used to build performant websites, it's all matter of optimization.

If you and your team better known Symfony, CakePHP or Zend, then go for it. You'll handle performance optimization once your application is functionnal, there are solutions for any frameworks.

If team experience is too wide and anyone has its own preference, then I would personnaly suggest Symfony, as its caching capabilities comes built-in with the framework (I don't know for others)

Upvotes: 6

Gaurav Sharma
Gaurav Sharma

Reputation: 2848

I recommend cakePHP v1.3 because it is faster and easily understandable. You will find very good help (documentation and tutorials) related to this framework. The documentation is well written. Even if you are stuck in somewhere you will be able to find a solution on stackoverflow or cakephp google group or by searching on google.

I have worked on both versions of cakephp (1.2 and 1.3) and I have also tried up a hand on Zend framework (I too tried my level best but got stuck in the framework when it came to the implementation of layouts).

But after spending more than a year on cakephp I am proud to say that it is the best framework to work with.

Upvotes: 8

Justin
Justin

Reputation: 5069

The differences are going to be negligible because your slow pieces are always going to be I/O - Database, Filesystem, etc. Ensure you have a good data caching strategy and don't do anything too outrageously dumb in the code and it won't matter.

Upvotes: 3

ircmaxell
ircmaxell

Reputation: 165261

The problem with benchmarks, is that they normally don't lend themselves to the real world. Write a real application, and you'll see that all the frameworks are within about an order of magnitude of each other when it comes to speed. And they are all slower than if you didn't use a framework (and know how to program).

However, what you need to look at is the tradeoff. Frameworks sacrifice a little performance for the ability to reduce development time significantly. What's more important to you, raw unadulterated performance or reasonably rapid development time? Facebook wouldn't use a RAD framework for their site, but that's because the performance to them is worth more than the added development time. Likewise a small company with a single developer is likely to benefit more from a framework than the reasonably small performance hit (I say small, because the impact on each page view is minimal. The effect "adds up" with higher traffic).

What I'd suggest, is take a look through a bunch of frameworks. Try them (most have a "blog" tutorial). Get a feel for how they work. Pick one that you like, and then play around with it for a little while. Learn its coding style, and how it likes to do things... Most importantly, learn how it functions. Try to learn the "why" behind the details. The ability to use a framework is IMHO directly tied to the understanding of how it operates... Don't use something you're uncomfortable using unless you have to. Find one that "fits" you, and then stick with it until you are fluent...

Upvotes: 20

Related Questions