PDA

View Full Version : coding optimization and performance


apm
05-16-2006, 06:28 AM
Hello guys,

was just wondering whether execution of 5000 lines of code based in a class whihc is called in every file does it take a lot of processing time ?

All the functions are not used everytime but cvertainly form part of the class.

The class file size is 400 kb.

so would it make a difference and reduce the lag time in showing the web page if I were to lets say break down the classes and and only load ones that are neccessary.

Or the server can handle it with ease without any substantial difference in lag times (10 secs or more difference, right now the page takes any where betoween 30 secs to 90 secs to load ).

just try to time it www.arc-max.com/yabadoo/

let me have your opinions.

thanks
apurva m

Arthur
05-16-2006, 06:37 AM
was just wondering whether execution of 5000 lines of code based in a class whihc is called in every file does it take a lot of processing time ? Or the server can handle it with ease without any substantial difference in lag times (10 secs or more difference, right now the page takes any where betoween 30 secs to 90 secs to load ).
You have answered your own question. The script takes unacceptably long to finish. Pages that take that long should not be run on a shared server and are a violation of the Terms of Service.

-Arthur

apm
05-16-2006, 07:52 AM
well i was trying ot figuiring out waht the problem is is it with my coding or with the server....

becuase if it is with the server then eeven if i break it up to smaller bits it still would be 1000 lines of code.. then will your server be handle it ??? or do we stick to plain html sites which od not tax the server ????


thanks
Apurva M

Arthur
05-16-2006, 08:11 AM
If the script consistently takes 30 to 90 seconds to run and other pages don't, you can safely say it's the script and not the server.

I have not done any profiling on the script, or even seen the script, so I can't comment on why it takes so long. All scripts are not alike, some can be very large, but use very little resources, and vice versa.
I'd recommend doing profiling on your code to see where delays occur and see if the code can be optimized.

-Arthur

apm
05-16-2006, 08:12 AM
oh just wanted to make it clear that we are not using futurequest o run the service a we are programing for one of our clients. This was merely to test how the code works on linux machine and it iwll most probably be on a stand alone machine....


it is not a continous test also just when we do the updates and need oto show it to our client...

so dont pull the trigger yet :D

thanks
apurva m

Matt
05-17-2006, 01:03 AM
was just wondering whether execution of 5000 lines of code based in a class whihc is called in every file does it take a lot of processing time ?The number of lines of code is not the determining factor in how resource intensive the script is. It will depend upon how many of those lines are typically executed and what those lines are doing. As an example, 1 line of code (infinite loop) would be sufficient to cause excessive runtimes. There are factors that contribute to a perceived long runtime as well, such as a complex (or poorly coded) SQL query or a script that embeds a large file (such as a graphic). In short, neither total lines of code nor download time are accurate indicators of actual CPU utilization.

-Matt

apm
05-17-2006, 01:20 AM
Thank you for your inputs.

Would like to know how does one go about doing a "profiling of codes" so that we can try to dtermine whihc part of code may require rrethinking....are there any tools availble ???

thanks
Apurva M

Bruce
05-17-2006, 01:33 AM
Would like to know how does one go about doing a "profiling of codes" so that we can try to dtermine whihc part of code may require rrethinking....are there any tools availble ???I haven't tried it personally, but this (http://www.adepteo.net/profiler/) appears to be a functional free PHP profiling system, and a good place to start looking.