views:

172

answers:

4

If I used Code Igniter or the Cake Framework, will it affect the performance of my application?

A: 

Possible disadvantages: (Sometime depends on your project)

  • Different framework have different coding convention. You have to learn these
  • Sometime you’ll not find any library which might be useful for you.
  • Not for small projects. Simple project custom coding will work faster than setting up a framework.
  • Extra overhead may affect performance
  • Not necessarily more secure (you'll need to pay attention to updates and such)
  • Much, much harder to customize
  • Takes time to learn and master

If you want to compare different frameworks.

NAVEED
so if i have large project custom coded that will work faster!! then using a php framework
getaway
@Solomon Saleh: Yes. PHP Framework is not very useful for small projects.
NAVEED
This post and the comments are not making any sense.
Matti Virkkunen
@NAVEED a PHP Framework will greatly simplify your efforts while development (even for small projects), isn't it? Ohh if performance is not that critical (than delivery time) we should use these frameworks. After all computers are meant for computation and making life simpler.
Ankit Jain
And a Framework has usually very good built-in things for security.
shamittomar
NAVEED by "small projects" what do you mean.. A lot of frameworks shine because you're able to setup a site in no time. Coding from scratch in most cases will always take longer. That article provides near to no information, especially on security - Which is one of the most important, almost the most important part of a good framework.
Kieran Allen
@Kieran Allen: I have a project: Get two numbers from user and print primary numbers in the range. What framework do you prefer!
NAVEED
Are you serious?! Hes talking about an application not a simple script... Looks like you're just trying to plug your own post. Nice.
Kieran Allen
@Kieran Allen: He did not ask performances of different php frameworks but he asked what possible effect on performance when using framework. It may be execution speed, it may be time spent learning a new framework, etc. But people are comparing different frameworks here which is off topic. Look at accepted answer.
NAVEED
+1  A: 

Look here, PHP framework comparison benchmarks.

But, if you need very fast performance, I would advise Yii because of its awesome performance.:

shamittomar
it even has jquery ajax support which is an excellent, deos yii have an active community!!
getaway
Yes, 250+ extensions: http://www.yiiframework.com/extensions/ and great forum: http://www.yiiframework.com/forum/
shamittomar
Why the downvote. Please enlighten.
shamittomar
-1 since benchmarks are for all practical purposes useless. They are only useful if your benchmarking the same real world problem as you're trying to solve. So it's mostly just marketing propeganda (since the final real world application performance will be FAR more dependent on your programming skill than the "speed" of the framework you choose...
ircmaxell
I didnt downvote, but even if benchmarks would have anything but suggestive meaning, that article is two years old and can only give an indicator about framework performance at that time.
Gordon
Is he asking for performance of different frameworks or he asked effect on performance when using a framework for a project ????
NAVEED
+5  A: 

If you define performance as speed of execution, then the answer is

  • Yes, it will degrade performance - always.

Frameworks offer abstractions over PHP's native functions. Whenever you put an abstraction onto something, you incur the penalty of loading the abstraction and invoking it's functions. Frameworks are usually general abstractions, that cater to a lot of UseCases. Solving a specific UseCase in your application can likely be solved with less abstraction.

But with frameworks you gain better modularization, faster development times (if you know the framework), better maintainability and (hopefully) tested code, which is usually worth it. That's not to say, always use a framework, but always consider the tradeoff - then decide.

As for benchmarks, well, have a look at

Gordon
And what about time spent on learning and switching between different frameworks for beginners
NAVEED
@NAVEED that's why I wrote "if you know the framework". And [I still believe beginners of PHP should not use frameworks](http://stackoverflow.com/questions/2064424/zend-framework-versus-kohana-versus-symfony/2064590#2064590)
Gordon
"Always" is too strong. A random example from the php docs: md5_file() is an abstraction over fopen(); md5(); fclose();, but using the abstraction probably has better performance than not. There are a lot of "it depends" issues. Remember we've got to compare YourCode vs YourCode+Framework. For example, if the framework makes it easy to do caching which you wouldn't have time to write yourself, using the framework could result in a better performing application.
Douglas
@Douglas `md5_file` is a native PHP function. When I am talking about abstraction here, I am talking about Userland implementations, because that's what frameworks are. Also, I am not saying writing your own abstraction is always faster for every developer. That indeed depends on individual skill. My point is, frameworks usually offer more abstraction that you need to solve for a concrete problem. Your framework's caching module might offer multiple backend adapters, when you only use `memcached`. Using `memcached` directly will be faster than using it through an additional abstraction on top.
Gordon