Distortion Posted January 2, 2010 Share Posted January 2, 2010 My website was loading fine on my localhost, but now I've uploaded it I found out that it is terribly slow. That is why I'd like to have some tips on how to speed up my website. So any tip is welcome :)What I'm trying to do is convert parts of my php code to Javascript, since I've been told that is much faster. I started on learning Javascript yesterday and I'm wondering which parts of php I should convert. Should I do everything in Javascript exept the queries?Last thing I want to ask is if the speed will go up much if I switch from free to paid hosting. Link to comment Share on other sites More sharing options...
Synook Posted January 2, 2010 Share Posted January 2, 2010 JavaScript can appear to run faster than PHP, as it can be written to execute asynchronously to page loading, but apart from that you will find little performance difference. Also, most things are just better off run on the server-side.It is best to try and figure out exactly what is making your website slower. You can run benchmarks on your PHP scripts (e.g. by calling microtime() at the start and end of the code and comparing), but I bet most of the delay is simply in the transfer of the completed document between the server and your machine. You can use a tool such as Firebug for Firefox to view the loading times for various resources.Switching to a paid server may help, as they may have more bandwidth allocated for customers, or servers in better geographical locations. Link to comment Share on other sites More sharing options...
Distortion Posted January 2, 2010 Author Share Posted January 2, 2010 Thanks for the microtime tip. And thanks for preventing my from converting everything :)Of course the only difference between localhost and on a server is that the transfer is slower... Link to comment Share on other sites More sharing options...
Distortion Posted January 3, 2010 Author Share Posted January 3, 2010 Turns out that my host uses a 'statcounter' code that slows my site down considerably. Link to comment Share on other sites More sharing options...
Redroest Posted January 3, 2010 Share Posted January 3, 2010 You must also consider reducing the number of query's. Using a query in a loop can be very timeconsuming and stressfull for a server. The same counts for making thumbnails and running loops and functions recursively Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.