Tips for Optimizing Your Website’s Speed

Rate this post

Situs page speed and performnce is very important to the pengalaman pengguna. If your site is too slow, you’ll not only be losing pengunjungs, but also potential customers. Search engines like Google faktor a website’s speed into akun in search rangkings, so when optimizing your site’s speed, you should take everything into consideration. Every millisecond counts.

Panduan for Optimizing Your Website’s Speed

Here are just a few general web optimization panduan for improving a site’s performnce and speed.

1. Defer Loading Konten When Possible

Ajax allows us to build situs pages that can be asynchronously up-dated at any time. This means that instead of reloading an entire page when a pemakai performs an action, we can simply up-date parts of that page.

We can use an gambar gallery as an example. Gambar files are big and heavy; they can slow down page-loading speeds of situs pages. Instead of loading all of the images when a pemakai first visits the situs page, we can just display thumbnails of the images and then when the pemakai clicks on them, we can asynchronously request the full-size images from the server and up-date the page. This way, if a pemakai only wants to see a few pictures, they don’t have to suffer waiting for all of the pictures to unduh. This development pattern is called lazy loading.


Ajax/situs development libraries like jQuery, Prototipe, and MooTools can make deferred content-loading easier to implement.

2. Use Eksternal JS and CSS Files

When the pemakai first loads your situs page, the browser will cache eksternal sumber like CSS and JavaScript files. Thus, instead of inline JavaScript and CSS files, it’s best to place them in eksternal files.

Using inline CSS also increases the rendering time of a situs page; having everything defined in your main CSS file lets the browser do less work when rendering the page, since it already knows all the model rules that it needs to apply.


As a bonus, using eksternal JavaScript and CSS files makes site pemeliharaan easier because you only need to maintain global files instead of kode scattered in multiple situs pages.

3. Use Caching Systems

If you find that your site is connecting to your database in order to create the same konten, it’s time to start using a caching sistem. By having a caching sistem in place, your site will only have to create the konten once instead of creating the konten every time the page is visited by your users. Don’t worry, caching systems periodically refresh their caches depending on how you set it up — so even constantly-changing situs pages (like a website post with comments) can be cached.

Populer konten manajemen systems like WordPress and Drupal will have static caching fiturs that convert dynamically generated pages to static HTML files to reduce unnecessary server processing. For WordPress, cek out WP Super Cache (one of the six critical WordPress plugins that Six Revisions has installed). Drupal has a page-caching fitur in the core.


There are also database caching and server-side scripts caching systems that you can install on your situs server (if you have the ability to do so). For example, PHP has extensions called PHP accelerators that optimize performnce through caching and various other metodes; one example of a PHP accelerator is APC. Database caching improves performnce and scalability of your situs applications by reducing the work associated with database read/write/akses processes; memcached, for example, caches frequently used database queries.

4. Avoid Resizing Images in HTML

If an gambar is originally 1280x900px in dimension, but you need to have it be 400x280px, you should resize and resave the gambar using an gambar editor like Photoshop instead of using HTML’s width and height attributes (i.e. ). This is because, naturally, a large gambar will always be bigger in file size than a smaller gambar.

Instead of resizing an gambar using HTML, resize it using an gambar editor like Photoshop and then save it as a new file.

5. Setop Using Images to Display Teks

Not only does teks in an gambar become inaccessible to screen-readers and completely useless for SEO, but using images to display teks also increases the load times of your situs pages because more images mean a heavier situs page.

If you need to use a lot of kustom fonts in your web, learn about CSS @font-face to display teks with kustom fonts more efficiently. It goes without saying that you have to determine whether serving font files would be more maksimal than serving images.

6. Optimize Gambar Sizes by Using the Correct File Pola

By picking the right gambar pola, you can optimize file sizes without losing gambar quality. For example, unless you need the gambar transparency (alpha layers) that the PNG pola has to offer, the JPG pola often displays photographic images at smaller file sizes.

To learn more about how to decide between JPG, PNG, and GIF, read the following guides:


Additionally, there are many tools you can use to further reduce the file weights of your images. Cek out this daftar of tools for optimizing your images.

7. Optimize the Way You Write Kode

Look around your source kode. Do you really need all the tags you’re using or can you use CSS to help out on the display? For example, instead of using
Your heading
, you can easily use CSS to make your headings italics using the font-style properti. Writing kode efficiently not only reduces file sizes of your HTML and CSS documents, but also makes it easier to maintain.

8. Load JavaScript at the End of Your Dokumen

It’s best if you have your scripts loading at the end of the page rather than at the beginning. It allows for the browser to render everything before getting started with the JavaScript. This makes your situs pages perasaan more responsif because the way JavaScript works is that it blocks anything below it from rendering until it has finishhed unduhing. If possible, reference JavaScript right before the closing tag of your HTML documents. To learn more, read about deferring the loading of JavaScript.

9. Use a Konten Delivery Network (CDN)

Your site’s speed is greatly affected by where the user’s location is, relative to your situs server. The farther away they are, the more distance the data being transmitted has to travel. Having your konten cached across multiple, taktikcally placed geographical locations helps take care of this masalah. A CDN will often make your operating biaya a little higher, but you definitely gain a speed bonus. Cek out MaxCDN or Amazon Sederhana Penyimpanan Servis (Amazon S3).

Lihat Juga: