Deep Dive on Solving Website Performance
Join the DZone community and get the full member experience.Join For Free
1. Basic Web Optimizations
- Concatenation and compression of CSS and JS:
- Lossless compression of images:
- Leverage browser caching: By setting sensible cache time limits on static assets, you can drastically improve the time load a page.
- Enable gzip compression of assets: If your server and clients supports gzip compression, enabling it could cut down your transferred response by up to 90%.
2. Browser Compatibility Quick Fixes
Need to support legacy browsers? Here are some handy open-source polyfills to solve some common older browser issues.
- Selectivizr: IE9 and below have limited CSS3 support, and therefore many (if not all) of the useful modern CSS selectors are not available without a polyfill.
- Respond.js: IE8 and below do not support CSS media queries. Load this in after your stylesheets have loaded and your long-suffering IE users will thank you.
- Webshim: This is legacy browser polyfill library which allows developers to dynamically load in polyfills for commonly used HTML5 features including forms, geolocation and even Canvas.
3. Mobile and Tablet Quick Fixes
Here are a couple of awesome open-source JS projects which will help boost your app’s performance on mobile devices.
- FastClick: Removes the awkward touch delay between a user’s finger hitting the screen and the ‘click’ event firing. Particularly useful for iOS, as while Chrome on Android can remove the delay with
user-scalable=no, and IE11+ has
touch-action: manipulation, Mobile Safari has no such setting currently available.
- Offline: Let your user know when they’re going offline, and stores their actions for when they are back online.
Organize your client-side code with a bundler like Webpack, Browserify, RequireJS or JSPM with System.js (especially awesome if you have a lot of third-party dependencies, and can run in either unbundled local dev mode or bundled production mode).
Bundlers cut down on blocking JS requests, compress code and to only load the scripts which are currently being used on the page.
Introduce usemin as part of your workflow to automagically replace non-optimized assets referenced in your templates. usemin also easily integrates concatenation, compression and file revving.
Published at DZone with permission of Gary Tuohy, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.