Web Develop Forum: How to speed up your front-end - Web Develop Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to speed up your front-end Rate Topic: -----

#1 User is offline   Sam Granger Icon

  • Administrator
  • PipPipPip
  • Group: Root Admin
  • Posts: 431
  • Joined: 22-October 08
  • Gender:Male

Posted 23 October 2008 - 09:56 PM

I thought I'd make a post about speeding up the front-end of a website. We all love sites that load fast don't we? So what can you do to improve your websites speed?

  1. Reduce HTTP Requests - Try to reduce the amount of files to load. This can include people having tons of javascript and CSS files. Try to keep this to a minimum where possible. However, the main thing that people don't do is make use of sprites. Sprites are basically images combined into one image. If you have a menu for example with a background image with a hover, it's best to have the hover background under the main background in the same image file. This is a very simple example but if you think about it, you can combine all kinds of images into one. By doing so, reducing the amount requests and images are then already preloaded so you don't get any annoying hover issues.
  2. Using remotely hosted files - Many files such as jQuery libraries are hosted for free on big sites such as Google. Quite a few sites already include these files. By doing so, a user may already have the file in their cache. Make sure that the file is on a fast and reliable server. Google: http://code.google.com/apis/ajaxlibs/


If you have any other suggestions or comments please post! If you have anything to add to the list, please share. smile.gif

Ofcourse you can also compress your js files and use gzip but focussing on the HTML/CSS and ways to include files here. smile.gif
0

#2 User is offline   Will Roberts Icon

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 64
  • Joined: 23-October 08
  • Gender:Male
  • Location:Buckley, North Wales

Posted 24 October 2008 - 07:09 AM

Clean Your Code - Try to make sure your code is small and clean. Even with CSS it is sometimes easy to go overboard with your <div> tags but with a little perseverence you may find you can limit them a lot more.

Smaller Images - Most of the time your images can be shrunk even more than you are doing. Try experimenting with filesizes whilst saving your images and you will notice an increase in speed on all of your pages. Sometimes you can even create your desired effect using CSS in your documents so look at that first as CSS is less bulky in size.

Repeater Images - Repeater images are generally used for things such as title bars where there is a gradient stretching vertically or horizontally. A lot of the time people use one large image covering the complete area they need to fill rather than creating a much smaller version and setting it to repeat using CSS. Always try to make use of repeater images where you can. Repeater images are much smaller in filesize and allow the same (if not more) flexibility.
My Portfolio: <a href="http://www.imagelimited.co.uk" target="_blank">I.M.A.G.E</a>
Submit Your Site: <a href="http://www.keepittidy.co.uk" target="_blank">K.I.T</a>
CSS & XHTML Tutorials: <a href="http://www.fatbasturd.co.uk" target="_blank">FatBasturd</a>
SEO Services: <a href="http://www.firstplaceingoogle.com" target="_blank">Firstplaceingoogle.com</a>
0

#3 User is offline   LewisR Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 26-October 08

Posted 26 October 2008 - 12:50 AM

good read
0

#4 User is offline   paulOr Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 20
  • Joined: 23-October 08
  • Location:Edinburgh, Scotland

Posted 02 November 2008 - 11:20 PM

Making my sites fast is something im really crap at, so thanks for the tips smile.gif
0

#5 User is offline   Sam Granger Icon

  • Administrator
  • PipPipPip
  • Group: Root Admin
  • Posts: 431
  • Joined: 22-October 08
  • Gender:Male

Posted 03 November 2008 - 01:52 AM

QUOTE (paulOr @ Nov 3 2008, 12:20 AM) <{POST_SNAPBACK}>
Making my sites fast is something im really crap at, so thanks for the tips smile.gif

smile.gif

Funny and sad thing is, programmers spend more time trying to get a site loading a few milliseconds faster than frontenders spend on speeding up the html/css code - which makes a bigger loading speed difference.
0

#6 User is offline   Salathe Icon

  • Advanced Member
  • Icon
  • Group: Moderator
  • Posts: 138
  • Joined: 15-January 09
  • Gender:Male
  • Location:Scotland

Posted 15 January 2009 - 01:31 PM

The Yahoo developer zone has an area dedicated to front-end performance (*giggle*) with lots of well thought out "rules" to aid in this process. A great place to start is their rules page: Best Practices for Speeding Up Your Web Site.
salathe@php.net
0

#7 User is offline   Sam Asante Icon

  • Advanced Member
  • Icon
  • Group: Moderator
  • Posts: 66
  • Joined: 18-January 09
  • Gender:Male
  • Location:United Kingdom

Posted 18 January 2009 - 10:39 AM

Good read.
I think I'll try using sprites in a navbar next time I code one of my designs.
0

#8 User is offline   Gaz Icon

  • Advanced Member
  • Icon
  • Group: Administrators
  • Posts: 178
  • Joined: 15-January 09
  • Gender:Male
  • Location:UK

Posted 18 January 2009 - 03:55 PM

One of the main errors that I used to make was to use too many divs. A regular example of this I see is:

<div id="nav">
<ul>
<li></li>
</ul>
</div>

Because ul is a block level element the div is not needed. I used to call this "DIVITIS"...!
0

#9 User is offline   Sam Asante Icon

  • Advanced Member
  • Icon
  • Group: Moderator
  • Posts: 66
  • Joined: 18-January 09
  • Gender:Male
  • Location:United Kingdom

Posted 18 January 2009 - 08:59 PM

QUOTE (-Gareth @ Jan 18 2009, 03:55 PM) <{POST_SNAPBACK}>
One of the main errors that I used to make was to use too many divs. A regular example of this I see is:

<div id="nav">
<ul>
<li></li>
</ul>
</div>

Because ul is a block level element the div is not needed. I used to call this "DIVITIS"...!


Does having Divitis effect the load time a lot?
0

#10 User is offline   Gaz Icon

  • Advanced Member
  • Icon
  • Group: Administrators
  • Posts: 178
  • Joined: 15-January 09
  • Gender:Male
  • Location:UK

Posted 18 January 2009 - 09:17 PM

Maybe not a huge deal, but I'm sure it would, yes. And taking in to account semantics etc. (not the purpose of the topic but still valid and important).
0

#11 User is offline   Sam Granger Icon

  • Administrator
  • PipPipPip
  • Group: Root Admin
  • Posts: 431
  • Joined: 22-October 08
  • Gender:Male

Posted 18 January 2009 - 09:29 PM

QUOTE (Sam Asante @ Jan 18 2009, 09:59 PM) <{POST_SNAPBACK}>
Does having Divitis effect the load time a lot?

Not really but it's unnecessary code really. Key to good code is to keep it as clean as possible.
0

#12 User is offline   Alex Leeds Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 26
  • Joined: 29-January 09
  • Location:South Florida
  • Interests:Website Development in HTML, CSS, Javascript / AJAX, and PhP

Posted 30 January 2009 - 02:48 AM

QUOTE (Sam Granger @ Jan 18 2009, 10:29 PM) <{POST_SNAPBACK}>
Not really but it's unnecessary code really. Key to good code is to keep it as clean as possible.


If by clean you mean:

CODE
<body>
    <div>
        <li>
            <a>link</a>
        </li>
    </div>
</body>


Then you would be incorrect. Although this is awesome for developmental stages. The best coding style is to take away ALL white spaces and tabs to reduce file size which will then reduce the amount the client has to download allowing a faster page load time.

Something like this is more efficient:
CODE
<body><div><li><a>link</a></li></div></body>


Also remember to compress your clean your css and javascript of ALL white spaces as well and not to double define when not needed.

Also another technique used by many companies out there is having images and javascript files on another deomain/subdomain. The reason for this is because a browser only opens two simultaneous connections to one single server. And browser will cache the dns immediately so you don't have to worry about the extra dns resolving going on due to the extra domain.

Another thing to point out is not using useless comments in css and html along with javascript. It's totally not needed and if you don't know whats going on then don't code laugh.gif

Anyway this is all I can think of at the moment since its getting kinda late here.

Enjoy!
Imglot.com - Free Image Hosting
0

#13 User is offline   Will Roberts Icon

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 64
  • Joined: 23-October 08
  • Gender:Male
  • Location:Buckley, North Wales

Posted 31 January 2009 - 06:51 AM

QUOTE (-Gareth @ Jan 18 2009, 03:55 PM) <{POST_SNAPBACK}>
One of the main errors that I used to make was to use too many divs. A regular example of this I see is:

<div id="nav">
<ul>
<li></li>
</ul>
</div>

Because ul is a block level element the div is not needed. I used to call this "DIVITIS"...!


The code you posted above is 100% ok to use and is not an "error". Sure you could shrink it a little and remove the div but what if you have a navigation bar that stretches 900px and you only want your menu to be 600px?

Simple, you use.....
CODE
<div id="nav">
<ul>
<li></li>
</ul>
</div>


That is why you see this used more and more wink.gif
My Portfolio: <a href="http://www.imagelimited.co.uk" target="_blank">I.M.A.G.E</a>
Submit Your Site: <a href="http://www.keepittidy.co.uk" target="_blank">K.I.T</a>
CSS & XHTML Tutorials: <a href="http://www.fatbasturd.co.uk" target="_blank">FatBasturd</a>
SEO Services: <a href="http://www.firstplaceingoogle.com" target="_blank">Firstplaceingoogle.com</a>
0

#14 User is offline   Diffraction Icon

  • Advanced Member
  • Icon
  • Group: Moderator
  • Posts: 279
  • Joined: 26-January 09
  • Gender:Male
  • Location:USA
  • Interests:Web Development, Reading, Writing, Computers in general...
  • Your specialities (detailed)::HTML 5
    CSS 3
    jQuery

Posted 31 January 2009 - 05:12 PM

It depends on this situation. Don't get in the habit of divitis.
Want to report something to a moderator? Use the 'report' button located on every post.
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users