|
Disclaimer:
These pages about different languages / apis / best practices were mostly jotted down quckily and rarely corrected afterwards. The languages / apis / best practices may have changed over time (e.g. the facebook api being a prime example), so what was documented as a good way to do something at the time might be outdated when you read it (some pages here are over 15 years old). Just as a reminder. Decrease the loading time for web pageshow to reduce number of http requests
Analogue for the javascript files.On the bundled javascript file I use yuicompressor, since it makes the file smaller than minify. However, yuicompressor does not make the css file as small as minify, so for the bundled css I use minify.The advantage of having it in the build process, is that I can edit away in different css/javascript files as normal and dont have to think about bundling them together and minifying it afterwards.Common javascripts, for example jquery, is not much point in hosting yourself, better link to the cdns, it reduces the number of parallel requests to your server.Flush at least after the HEAD-tag, so the browser can start loading css/javascript files. It might make sense to show your header / menu etc and flush after that, so if the user just passing through and wants to click onto some other page in your menu, they can do it quickly. but put up some text "Page is loading..." or something, so the user do not think that the page was faulty loaded.If the javascripts are not immedieately needed, try put them at the BOTTOM of the page, that will prevent the javascript src from taken up request space from for example css or images.Use css sprites; bundle images together into one image (hence only one http request to fetch several images), and display different parts of that image using the css background-image /position.Memcache anything that makes sense, keep in mind that you can also cache chunks of html to avoid recalculating stuff (it is not just db-requests that slow things down), but make sure you have proper handling of the data with/without memcache. A good test is to bring memcache down and the web page should still look nice.Turn on gzip on anything that makes sense (e.g. not useful for pdf, but for ccs and js)But getting a bit off topic, just wanted to mention the number of http requests which people tend to forget about. Google around and you will find other tips on how to speed up your website. More programming related pages |