Dayo Posted July 31, 2010 Share Posted July 31, 2010 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 Global handler (handles the classes) DB Class User Class CSS/JS generator class Game Logs Template Class + triggers (ie errors, warnings etc...) What would you say is an ideal load time for a full working RPG script? Quote Link to comment Share on other sites More sharing options...
Equinox Posted August 1, 2010 Share Posted August 1, 2010 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 Quote Link to comment Share on other sites More sharing options...
Floydian Posted August 6, 2010 Share Posted August 6, 2010 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 Quote Link to comment Share on other sites More sharing options...
LordDan Posted August 6, 2010 Share Posted August 6, 2010 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: Quote Link to comment Share on other sites More sharing options...
Paddy Posted August 7, 2010 Share Posted August 7, 2010 Thanks lordDan for that snippet.. is it possible to get which pages they are rather then just [included: 4]? thanks Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted August 7, 2010 Share Posted August 7, 2010 foreach (get_included_files() as $filename) { echo $filename.' '; } should work. Quote Link to comment Share on other sites More sharing options...
Paddy Posted August 7, 2010 Share Posted August 7, 2010 yes it did thanks Quote Link to comment Share on other sites More sharing options...
Spudinski Posted August 8, 2010 Share Posted August 8, 2010 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. Quote Link to comment Share on other sites More sharing options...
Henrietta Posted September 8, 2010 Share Posted September 8, 2010 Counting include files is a way to nowhere. Focus on your algorithms, DB schema and queries. Besides, there are plenty of accelerators around to help up with PHP itself. Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted September 8, 2010 Share Posted September 8, 2010 But counting the included file's, and checking how long each of them take to include is good, thus can help you show what file is taking so long and either do something about it or what ever. Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted September 8, 2010 Share Posted September 8, 2010 reducing include file or size of the include will indeed speedup the PHP execution, even with some accelerator. Why so? Because PHP is an interpreted language and therefore for each include it will take time, even if an accelerator will help as it normally caches the "pre-parsed" code. Quote Link to comment Share on other sites More sharing options...
Henrietta Posted September 13, 2010 Share Posted September 13, 2010 True. By so-very-negligible amounts, it's probably not worth to focus on it at all. Time costs, write yer code instead of counting your files. Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted September 13, 2010 Share Posted September 13, 2010 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.