Hello, on my site I have an index file that is quite lengthy. I’m curious how long the index file needs to be to slow the website down. My server only has about 4 gigs of ram and the upload is about 10mbs.
It is not how “long” the page is. It is how big it is. One large optimized photo is enough to slow a page down. Better thing to do is look at the network tab of your browser dev tools and see how large the overall page load is and also the load time of individual page components.
Sorry, maybe I should have reworded it better, I was talked about the PHP backend script length.
If you think there is too much code in one page perhaps you need some code separation. It is one of the basic concepts of programming. Without seeing what you have it is hard to tell you anything. An index page should really not need much code at all. In one of my bigger projects the index is only 8 lines.
Good point, I use my index.php file for routing, thats why its quite long. I’m working on splitting it up at the moment however.
Perfect candidate for a routes.php
If you put your project on Github I (we) can advise you on the project as a whole. (No Charge, Merry Xmas)
Thank you! I do have it up:
Its a bit sloppy, but it works.
Have you had to tweak up time limit, max execution time, or memory limit? Doing so is a sure sign of unwieldy script. IMO maybe OK for your own use on your own machine, but should be avoided on a public facing server.
Ah, very good point. I’ll mess around with my php.ini file, might explain some of the lag.
Shaved off a few seconds of load – a while back I added a request for a geolocation API for every page, a terrible idea. A Cloudflare header solves this issue.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.