Jump to content
MakeWebGames

PHP Load Times


Dayo

Recommended Posts

Hiya as some of you may know im making my own RPG engine (Not for distribution) but for my network, i have started making the framework atm my page load time is 0.0130-0.0200 seconds i have never looked into the loading times so not sure if this is good or not (BTW this is loading several files each with a few hunderd lines of coding).

Loaded on this page

  1. Global handler (handles the classes)
  2. DB Class
  3. User Class
  4. CSS/JS generator class
  5. Game Logs
  6. Template Class + triggers (ie errors, warnings etc...)

What would you say is an ideal load time for a full working RPG script?

Link to comment
Share on other sites

Well, I am working on something fairly big and it does need to include quite a bit but I'm some what of an efficiency freak.

Mine is including:

A DB class (fairly big)

A functions file (handles a multitude of different functions - I decided to keep seperate from the class)

Template - few images

Huge CSS file (been compressed)

Sort of a 'games log' thingy (records most of a users activity - only what's needed)

And I have an error handler, and some other minor things that really aren't that important.

I done this speed test in a global file and loaded the page I was working on at the time which was fairly big, my results are as follows:

This page took 0.002826 seconds to load.

This page took 0.003050 seconds to load.

This page took 0.002796 seconds to load.

This page took 0.002796 seconds to load

This page took 0.002813 seconds to load.

This page took 0.002698 seconds to load.

Now I've added a few more queries as a test and got these results:

This page took 0.002890 seconds to load.

This page took 0.002858 seconds to load.

This page took 0.002857 seconds to load.

This page took 0.002828 seconds to load.

This page took 0.002805 seconds to load.

This page took 0.002794 seconds to load.

Finally a few more select queries and I got these results:

This page took 0.002937 seconds to load.

This page took 0.002841 seconds to load.

This page took 0.002872 seconds to load.

This page took 0.002896 seconds to load.

This page took 0.002843 seconds to load.

This page took 0.002995 seconds to load.

Hope this helps

Link to comment
Share on other sites

It seems like both of you are measuring the php processing time. The biggest time consuming part of delivering a web page to a user is sending the data over the wire. Another issue that hugely dominates over php processing time is javascript execution time (and possibly locking of the browser during script execution).

One can easily shave a tenth of a second by focusing on those areas, which is far more time than all of the times listed in the first two posts (measured by the hundredths and thousandths, as opposed to tenths). Therefore, if you php execution time stays well below the time it takes to deliver a page to a user, then it's not worth focusing on optimizing the php execution times.

Cheers

Link to comment
Share on other sites

Just an additional note: I often use the following snippet to find out how many files i am including to aid me reduce the amount of includes where possible.

 

echo 'Included: '.count(get_included_files());

 

get_included_files() returns an array so you can use foreach to display the included file names as well if needed. It's not exactly what you're asking for/about, but hopefully it'll be of some use to you. :thumbup:

Link to comment
Share on other sites

One has to remember, PHP is only there to process the set of instructions that you have defined.

Efficiency is great when you nail it, but to some extent you can't cut to much code.

I'd agree with Floyd, the time taken for the page to actually reach the user is most important.

I wouldn't worry about too much efficiency until you test out the full product in a production state.

Link to comment
Share on other sites

  • 5 weeks later...

Well indeed it's a lot more important to make your site work. The golden rule of optimization is => do it at the end. Why? Because generally when you optimize you make your code harder to read. Yet of course a bad design will be badly optimized too...

For the real effect, it has some noticeable effect, yet again depends of your project.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...