5

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

George Stocker
  • 57,289
  • 29
  • 176
  • 237
getaway
  • 8,792
  • 22
  • 64
  • 94
  • 3
    Codeigniter is supposed to be one of the fastest php frameworks out-there and thats because it doesn't include anything by default every-time you need to a functionality you just include it in your project I'm not so aware of other frameworks but the benefit from using a framework goes a lot deeper that performance issues... – rabidmachine9 Aug 28 '10 at 12:33
  • 1
    +1 to undo the downvote. This is a legitimate and useful question and the downvote is not justified. If it is on the bases of the question being a duplicate, then provide a link to the original question when you downvote. – Majid Fouladpour Aug 28 '10 at 13:15
  • @Majid: Duplicate at the bottom of this question: http://stackoverflow.com/questions/1670003/framework-comparison-and-overhead – George Stocker Aug 28 '10 at 14:03

4 Answers4

5

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
  • 312,688
  • 75
  • 539
  • 559
  • And what about time spent on learning and switching between different frameworks for beginners – Naveed Aug 28 '10 at 13:16
  • @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 Aug 28 '10 at 13:23
  • 1
    "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 Aug 28 '10 at 13:30
  • 1
    @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 Aug 28 '10 at 13:44
2

Look here, PHP framework comparison benchmarks.

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

shamittomar
  • 46,210
  • 12
  • 74
  • 78
  • it even has jquery ajax support which is an excellent, deos yii have an active community!! – getaway Aug 28 '10 at 12:51
  • Yes, 250+ extensions: http://www.yiiframework.com/extensions/ and great forum: http://www.yiiframework.com/forum/ – shamittomar Aug 28 '10 at 12:52
  • 4
    -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 Aug 28 '10 at 13:10
  • 1
    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 Aug 28 '10 at 13:11
  • 1
    Is he asking for performance of different frameworks or he asked effect on performance when using a framework for a project ???? – Naveed Aug 28 '10 at 13:55
0

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
  • 41,517
  • 32
  • 98
  • 131
  • so if i have large project custom coded that will work faster!! then using a php framework – getaway Aug 28 '10 at 12:32
  • 1
    @Solomon Saleh: Yes. PHP Framework is not very useful for small projects. – Naveed Aug 28 '10 at 12:33
  • 1
    This post and the comments are not making any sense. – Matti Virkkunen Aug 28 '10 at 12:40
  • @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. – ankitjaininfo Aug 28 '10 at 12:40
  • And a Framework has usually very good built-in things for security. – shamittomar Aug 28 '10 at 12:41
  • 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 Aug 28 '10 at 12:41
  • @Kieran Allen: I have a project: Get two numbers from user and print primary numbers in the range. What framework do you prefer! – Naveed Aug 28 '10 at 13:25
  • 1
    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 Aug 28 '10 at 13:32
  • @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 Aug 28 '10 at 13:54
0

Take a look at these two answers:

One on benefits and disadvantages of frameworks

One on benchmark comparisons of frameworks, and how they are all but meaningless

Community
  • 1
  • 1
ircmaxell
  • 163,128
  • 34
  • 264
  • 314