Codeigniter: Profiling and Performance

I am new to application development and CI in general, so I have a bunch of questions.

What is profiling? How is it used? How it works? What is considered a β€œlong” time?

More importantly,

How to use it to increase productivity?

The reason I'm asking is b / c, because my application is really really sluggish right now.

+6
performance profiling codeigniter
source share
5 answers

When tuning performance, the bottom line is how long the program takes in wall clock mode to complete a given task. I know this sounds like DUH, but that is one concept that everyone can agree on.

There is a very firm belief that in order to find code that you can fruitfully optimize to speed up the program, you do this by measuring the time spent on various functions and counting how many times they are called.

Even the technology engineers, who I thought would have known better, offered to provide me with good timers and counters when they build a set of boards that I tried to program, thinking that this would help me set up the software.

NO THANKS, I told them. All I need is a way to stop him at random and ask what he does and why he does it. This is a "random" and "do something" approach. If I do this several times, and a good chunk of time is spent less than productively, the likelihood that I will not catch it is basically zero.

more about this.

+9
source share

As it should be clear, when you use profiling, it is used to see how fast the aspects of the page are. Put this line in the main controller near the beginning (for example, in the constructor immediately after calling the parent constructor:

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

This will print a large amount of profiling data at the bottom of your resulting page. This will include all database queries, how long it will take and how much time has passed in the controllers (PHP time as opposed to database query time).

If something starts slowly by turning on the profiler and checking if it is a controller or requests (or both). If these are database queries, then you need to improve them and that is the topic itself. If these are controllers, then you need to figure out which code is causing the slowdown.

Read https://ellislab.com/codeigniter/user-guide/libraries/benchmark.html and start placing benchmark start and stop tags, where you think it might cause slow speeds, loops and any recursive functions are the first places. which you should check. After you find the slow code segment, you need to find how to choose it, which again is a whole worm of worms.

It is possible that slow speeds are associated with poor equipment, a busy server, a slow connection, or a ton of other problems, but they are not within the scope of this issue.

Edit: I just want to add that you are not using the capabilities of the CI profiler or benchmarking to improve speed, only to find where speed should be improved. I know this is a trifle, but I just thought that I should point it out.

+10
source share

Here are a few topics that I discovered while researching CI performance / benchmarking:

http://codeigniter.com/forums/viewthread/101804/P0/

http://www.haughin.com/2008/02/13/optimizing-and-scaling-your-codeigniter-application/

In the first thread, I believe there was some discussion of benchmarking, but I never found a final set of numbers that would help compare the application.

+1
source share

http://lonnieezell.com/blog/web-development/introducing-forensics-profiling-for-codeigniter/ This is a good performance measurement plugin for coding applications.

0
source share
0
source share

All Articles