logo

JavaScript Essentials

Worth a read is the YUI team's Performance Research article, which discusses how browser caching affects the user experience. It concludes:

Keep in mind the empty cache user experience. It might be more prevalent than you think!

With this in mind you have to question the logic in using libraries such as YUI in the first place. Especially one made up of so many different .js files, as the more files the page needs the longer it takes to load. Loading one 100kb file is quicker than loading ten 10kb files!

That's why it's refreshing to see Dan Webb create a 5kb JavaScript file containing nothing but the Scripting Essentials — things like the $ function, the DOMContentLoaded event and some array methods. It's missing any Ajax methods but they're easy to add. You could get everything you needed in to a 10kb file I'm sure.

Also on the small side is jQuery, which weighs in at <20kb. If all you're looking for are the essential then maybe this is worth a look. Until now I'd not bothered with it, but now I'm tempted. While I enjoy playing with YUI and Jack's extension to it I can't help feeling it's a little OTT for 90% of my needs.

Comments

  1. Personally I like MiniAJAX {Link} for those times when I really need small functionality. Small, simple, functional and does exactly what it says on the tin.

    • avatar
    • Jake
    • Tue 16 Jan 2007 07:56 AM

    This is s test. I am posting this from a BlackBerry. Moe on this tomorrow....

  2. Jake,

    I'm taking this from Jack's comments regarding the latest entry DomQuery where he mentions that you don't need to use the whole YUI and the footprint can end up much smaller. {Link}

    here it the text:

    2) The template class can be replaced easily by this short function:

    function applyTemplate(format, args){

    return format.replace(/{(d+)}/g, function(m, i){

    return args[i];

    });

    };

    So you see, the amount of code is not 90k, but 6kb + that function + whatever getStyle function you want to use. I can create a stand alone version, I have no problem with that.

  3. One thing to remember is that Yahoo's research is based off of public sites and applications. Most of what I write (and many others I suspect) for the Domino environment is for internal facing applications. I would hazard a guess that the amount of "empty cache" users going to an intranet location is much less than that of the internet.

    For public websites I really think the centralized hosting idea is the best bet for larger libraries. Dojo for example has a copy being hosted by AOL that anyone can include into their applications. That way if a user visits multiple web sites using Dojo they only need to download the library for the first site and it will be cached for the second.

  4. Yeah, I think some of these libraries are way too bloated to use in non-intranet environments. YUI, DOJO, Prototype - they're all too big. Centralized hosting is a cool idea, though.

    Another good "small" library experience is MooTools. Their website allows you to build a compressed js file with only the subsets of functionality you need for your app.

    • avatar
    • Bill E
    • Tue 16 Jan 2007 12:03 PM

    I am going through this currently. Prototype and tinyMCE, and then some minor stuff, too. It does add up. Going through now and striking out & combining as best as I can all the js files. It will probably never be easier, too.

    • avatar
    • Matt
    • Wed 17 Jan 2007 06:33 PM

    I would highly recommend jquery. It has completely change my javascript programming for the better. I had used Matt kruse's scripts (which are stilll great) and prototype.js, but this is far easier to write compact, easy code.

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Tue 16 Jan 2007

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

Elsewhere

Here are the external links posted on the same day.

More links are available in the archive »

More Content