2

My CodeIgniter application is running very slow, I enabled the profiler and I set up the benchmarks and this is what I get:

Loading Time: Base Classes                      0.0009
Leads Model                                     0.0007
Url Helper                                      0.0000
Check Session                                   0.0000
Load Form Helper                                0.0000
Load Main Data                                  1.0286
Load Head                                       0.0001
Load Header                                     0.0001
Load Lists                                      0.0003
Load Footer                                     0.1239
Load Main Script                                0.0002
Load Map Edit Script                            0.0000
Controller Execution Time ( Leads / Index )     104.3904
Total Execution Time                            104.3914

QUERIES: 12 (0.1479 seconds)

Every time I refresh my page this is what I get. Everything that's getting loaded inside index() function takes time as expected but the total Controller Execution Time is much higher than the total of all the times. Thanks for your help in advance.

zeus
  • 244
  • 3
  • 12

1 Answers1

0

Looks like this may be any issue that exists within your code. Likely the speed issue is in one of your views. Possibly a loop of some sort that may be closed properly.Again using Xdebug and creating a output profiler, makes it dead simple to find what is running slow, however, it maybe helpful to add this around each view your are loading:

$this->benchmark->mark('header_start');
$this->load->view('header', $data);
$this->benchmark->mark('header_end');

$this->benchmark->mark('filter_start');
$this->load->view('filter', $data);
$this->benchmark->mark('filter_end');    

$this->benchmark->mark('footer_start');
$this->load->view('foooter', $data);
$this->benchmark->end('footer_end');

For each view you are loading set a benchmark to indicate each view being loaded. Then with the output profiler still enabled, the elapsed time for each view will be displayed at the bottom of the page. For the offending file, set more benchmarks inside the code to find which code block is taking the longest time to execute.

always-a-learner
  • 3,671
  • 10
  • 41
  • 81
  • I am doing exactly what you are suggesting and the list I posted above is the result of results I got after doing this – zeus Sep 07 '17 at 06:52