Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a website run faster?

Tags:

browser

css

web

I'm into my first 3 months of web development and I have been dabbling with some server side scripting in the form of ColdFusion, along with some Javascript, JQuery and CSS.

I have read about CSS optimization and would like to know what are the other pertinent factors contributing to the better performance of a website. What all factors can a developer profile and optimize?

How much part does picking (or rather I should say recommending) a particular browser play in this performance hunt?

cheers

like image 720
Arnkrishn Avatar asked Jun 29 '09 06:06

Arnkrishn


People also ask

Why is my website so slow?

Slow site speeds can result from network congestion, bandwidth throttling and restrictions, data discrimination and filtering, or content filtering. If you notice slow speeds when visiting your site, you can run a traceroute between your computer and your website to test the connection.


2 Answers

Install YSlow and Pagespeed plugins for Firefox. Then start looking at all of the ways your site is unoptimized. This will be much like trying to take a sip of water from a fire hydrant.

Using minified ( and possibly aggregated ) Javascript and CSS along with a good, healthy far-future-expires is a really good way to start.

  • Don't forget to gzip.
  • And use Etags.
  • And put your CSS at the top of the document.
  • And put the javascript at the end.
  • And use separate domains for static resources.
  • And avoid URL redirects.
  • And remove duplicate javascript and CSS.

And... see what I mean about the fire hydrant!

like image 87
Darren Hicks Avatar answered Oct 18 '22 20:10

Darren Hicks


Just to sum the stuff up from above:

The speed of a website depends on a few things:

  • Server
  • Connection
  • Client

And on each of this part you can do improvements.

Server: if you rely on a database, check if you queries are cached, and more importantly check if your data is cached. For example if on every page you get a menu from the database, then you can cache that result. In addition you can check your code and see if there is room for optimization. Also the hardware itself plays a role. If you are on a shared hosting plan, maybe the server is full of other not-optimized apps that take a toll on the server.

Connection: Here the YSlow and Pagespeed come in handy, as well as Fiddler. You can do some caching of static content (CSS and JS). Set their expire date far in the future. Using GZIP to make their contents smaller, and combining the static files helps to a certain extent. In addition maybe the server has a low bandwidth.

Client: if you do wacky javascript or have slow css selectors, this might hurt performance on the client. But this depends on the speed of the client's computer.

like image 35
Gideon Avatar answered Oct 18 '22 21:10

Gideon