Sign Up Login Videos

How can I speed up my website?

2

How can I speed up my website?

So this one isn't really a question, maybe I should put this in a different part of the site but here goes.

The speed of your website is really important because if your site's slow people will get bored and leave.

Here are some tips to speed up any website.

Use a CDN for static files.

CDN's speed up your site by hosting your content closer to your users. They can also do fancy things like compress your files to make things even faster.

Host static files on a different domain

  • Browsers only allow around 5 simultaneous requests per domain. This mean's if you're loading lots of CSS and images the browser will only download them in batches of 5. Static files on howcode.org are hosted from s.howco.de and user profile images are hosted from i.howc.de. This allows more simultaneous requests.
  • If you use cookies on your site every request the browser makes to your domain will include your cookies. That means every request for an image, stylesheet or javascript file will all include your site's cookies. Using a different domain for static files means the browser won't send your cookies inside your requests.

Cache everything

Cache your CSS forever - You don't need your CSS to change, so you can cache it long into the future. Below is the code that includes howcode.org's CSS.

<link rel="stylesheet" href="https://s.howco.de/c/css/c8de0bf11df7.css" type="text/css" />

That's a weird name for a CSS file, right? (c8de0bf11df7.css) That's because that CSS file is regenerated everytime it changes. That means we can cache it forever because when I change it, the user just downloads a new file with a different name. Caching the CSS saves 15KB from every request.

Load images in the background

Use Javascript to load your images in the background, doing this will mean your page downloads much quicker and the user will see the loading spinner in the browser disappear quickly.

You can even improve on this by showing the user a small, blurry version of the image and then replace it with the high-quality version once it's finished downloading in the background.

If you use Cloudflare it can do this for you.

These are some ideas that howCode uses that can help you get started. There are many more tricks you can use to speed up your website.

If you'd like to see more like this, let me know!

  • HTML
  • howcode.org
  • Other

3 Replies

Can you make a fully explained video on making this howCode website? Please upload more frequently because I have nothing to watch except howCode so I watch your videos again and again.

2

Can you make a fully explained video on making this howCode website? Please upload more frequently because I have nothing to watch except howCode so I watch your videos again and again.

I'm not sure if I'll make a video on the topic but I'll certainly be writing more tutorials on it soon! I'll be making more videos as soon as I can. 😁

1

I'm not sure if I'll make a video on the topic but I'll certainly be writing more tutorials on it soon! I'll be making more videos as soon as I can. 😁

Hey Francis! You made my day by replying. So, I have a suggestion for you.

MAKE YOUR OWN LARAVEL [HOWGREATCODE SEASON 1]

0

Hey Francis! You made my day by replying. So, I have a suggestion for you.

MAKE YOUR OWN LARAVEL [HOWGREATCODE SEASON 1]

x