Welcome Guest, Not a member yet? Register   Sign In
Incredibly Slow CodeIgniter Application
#1

[eluser]Diamons[/eluser]
I bought a script based off of CodeIgniter (http://bit.ly/ll01Kr). The execution time for the homepage and some other pages is 7ms+. Sometimes, I even get 15ms. This is all using the CodeIgniter profiler.

If i delete the entire view file or template file, I get speeds of < 1ms. So I believe the view files are causing a delay. Can anyone help me out with this?
#2

[eluser]Aken[/eluser]
How is 15 milliseconds slow, again?

We can't help without seeing the code causing the issue. Please use a service like Pastebin if you want to show the code here, since the forum both limits the amount you can post, and will mess with some source code.
#3

[eluser]TheFuzzy0ne[/eluser]
Fif... Fif... Fi... I can't even type "fifteen" in fifteen milliseconds...
#4

[eluser]Diamons[/eluser]
Whoops! 15 seconds, not milliseconds.

http://pastebin.com/8ahbEts5 (view_home, clearing this speeds everything up to < 1s)

is the code for the homepage
#5

[eluser]TheFuzzy0ne[/eluser]
I suggest mentally breaking your app up into pieces, with the [url="http://ellislab.com/codeigniter/user-guide/general/profiling.html"]profiler[/url], and add benchmarks into your application flow. Use a bit of common sense, and move the benchmarks around in your app to see if you can find the bottleneck(s).
#6

[eluser]Diamons[/eluser]
MEMORY USAGE
5,852,528 bytes

Loading Time: Base Classes 0.0128
Code 0.0185
Controller Execution Time ( Home / Index ) 14.5379
Total Execution Time 14.5510
#7

[eluser]TheFuzzy0ne[/eluser]
I can't profile it for you, you'll need to do that yourself. Smile
#8

[eluser]Diamons[/eluser]
Solved, thank you! This was my first time having any such issue so I had no idea where to begin...but for others having the same issue, I did the following.

I used this code: http://www.3cc.org/blog/2010/09/benchmar...microtime/

I basically did what @TheFuzzyOne recommended and just broke down the site until I found the lines causing the delay. It turns out the script had a poorly written currency converter that would make a request to Google every time.
#9

[eluser]TheFuzzy0ne[/eluser]
Glad you got it sorted. Smile

But for the record, the profiler's benchmarking facility works in (almost) exactly the same way. Wink
#10

[eluser]Diamons[/eluser]
Are you talking about XDebug, or the built in CI one? I used the built in CI one and it just gave me one large output but it didn't explain what was going on.




Theme © iAndrew 2016 - Forum software by © MyBB