Ways to Improve Extremely Slow Codeigniter Website

improve the performance of codeigniter

Performance depends slightly on framework, CI itself is one of the fastest.

Your project performance mostly depends on your code, how you use PHP, how you create queries and maintain JS code.

Short answer to your question:

  1. CI active record class is garbage, use classic queries / alternative PDO.
  2. Use advantage of condition-loading helpers/modules
  3. Don’t use security class functions unless it’s necessary
  4. Study config files, there is much you can disable to speed up.

This can help, may not, best way to avoid performance problems is to study how languages work, for example you can get valuable performance info about PHP here.

=========================================================================================================================

1) Autoload class will obviously make your application slower. because it uses php4 require function to load files. there are some hacks to use php 5 autoloading feature. Hope, new owner of codeigniter will add add support for autoloading.

2) It is best to use load specific models rather than autoload. in previous point I stated the reason behind this. basically it is good practice to load only the needed model, helper, library and assets. it assures that you use minimum time and memory.

========================================================================================================================

i’m not sure which section costs you time but you mix a lot of actions in this controller function all database actions und readings should be done in a model

furthermore if you want to know which things slows down your application, Codeigniter comes with an excellent Benchmarking and Profiling Tool

If you want to see a summary you should use the Profiler class – it will display some benchmark results

just place this line in your controller

$this->output->enable_profiler(TRUE);

For further information take a look at the documentation – below are the links

Codeigniter Profiler

Benchmark Class

 

(Visited 18 times, 1 visits today)

Comments

comments

Leave a Reply