tags:

views:

357

answers:

2

I've seen many sites based on YUI, but all are very slow-responding. Is there any good solution for this, to make those javascript files lighter and faster?

I've now already used a yuicompressor and another javascript compressor, but it is still too slow.

It seems YUI considers too many corner cases so that each file is very big. If the size can come down, I'm willing to accept some of those corner cases in fact..

one thing about YAHOO.util.Event.addListener, do you know how its implementation is? Does this function listen on global document then fire event when neccesary? I think it'll be horrible if like that. But I've not dig deep enough to find out yet.

+2  A: 

You could take a look at the YUI's 34 best practices to see if you missed any of those.

You could also look for bootlenecks within your site, there are lots of profilers out there. There is the firebug's profiler that helps you to identify some cases, and there is also the YSlow plugin for it.

Hope this can point you in the right direction, good luck!

Pablo Cabrera
Ok,thank you,I'll go though those one by one:)
Shore
one thing about YAHOO.util.Event.addListener,do you know how its implementation is?Does this function listen on global document then fire event when neccesary?I think it'll be horrible if like that.But I've not dig deep enough to find out yet.
Shore
Don't think so, It relies on the browser's native event listeners: addEventListener (most browsers) or attachEvent (Internet Explorer), and in other cases it uses "on*".
Pablo Cabrera
A: 

One thing I've done that has sped up my YUI sites dramatically is to use the Yahoo CDN.

G-Man

GeoffreyF67