*7.07* KB of JavaScript in Ra-Ajax

October 18, 2008
Kariem has lately focused a lot on compression and our build system which is based on nAnt. You should read both of his blogs about this subject. In his WebResource.axd and JavaScript GZip Compression blog he talks about how he managed to GZip our Ajax library within the build system almost without adding overhead at all for our end users. And in his latest Ra-Ajax 0.6.1 Release blog he talks about the size of our JavaScript in our latest release.

Ajax and sizeof(belly)

I realize that the numbers in the header of this blog is difficult to believe, especially considering that most other Managed Ajax libraries and frameworks tends to ADD JavaScript size compared to "un-managed" (JavaScript-knowledge-required-based) Ajax Libraries. And with jQuery, Prototype, MooTools, Dojo and friends surfacing almost at (and some far more than) 100 KB, to believe that Ra-Ajax has *7 KB OF JAVASCRIPT* is hard to believe. That's why I am so happy that you can verify this yourself by using e.g. YSlow to check that what I am saying is actualy true!

And in that number we have *19 Ajax Controls* ranging from pretty complex stuff like our Ajax TreeView control and our Ajax Window control to more simple building block controls like our Ajax Button control and our Ajax DropdDownList control. Mostly everything you need when you build your Rich Internet Applications...

This is because of the architecture of Ra-Ajax which enables us to build really complex controls out of only the already existing "building block" controls. Like for instance our Ajax TreeView Control which is entirely built reusing only other already existing Ajax controls.

So as long as you're not using the;

Which adds up their own "custom JavaScript controller files" - You can actually create as complex applications as you can dream about and still have *7 KILOBYTES* of JavaScript in your end result!

And even if you're using all the core controls, Comet, Timer and RichEdit in addition you're still in less than 10 KILOBYTES of JavaScript land. Or to be more precise; 9.28 KB of JavaScript in total. And that includes a RichEdit component, an Ajax Timer, a fully fledged Comet implementation, and 19 other Ajax Controls basically serving [mostly] all the needs you'll probably ever need in regards to Ajax.


Ra-Ajax JS size compared to other Ajax Frameworks


I've written about this previously in my Comparing popular Ajax Frameworks in YSlow blog. Though I feel that blog probably held "too much information" for people to be able to "see it", so I'll do a fast recap on only the JavaScript size of popular Ajax Frameworks here in a nice and visual table for you to be able to see the real difference between them.

FrameworkJavaScript size
Ra-Ajax7.07 KB
jQuery16.7 KB
Prototype.js23.1 KB
Dojo25.2 KB
MooTools core (unzipped!)64.1 KB


Now to put this a little bit into "perspectives" I've constructed a visual graph for you to look at;

Ajax Frameworks size comparison sheet

Though even the above comparison doesn't justify the "real" overhead since with Ra-Ajax no matter how much logic you have on the page it will add ZERO JavaScript to that page. While with all the other JavaScript Frameworks you will end up with a lot of "custom JavaScript" which further adds to the JS size, and also the above numbers are only the core components of the given JS libraries. Meaning no Ajax Menu, no Ajax TreeView, no Ajax Window and so on - which Ra comes with out of the box in its numbers.


My point


A lot of people are staying away from Managed Ajax libraries since they falsely believe that Managed Ajax Libraries are bloating the JS size for the client. The above comparison clearly shows that is not true! At least not for all Managed Ajax Frameworks. Ra-Ajax clearly shows that it's more than possible to create a Managed Ajax Framework and still have a fraction of the JavaScript download size for the clients.

But I realize that to change people's perception of things one must also change their expectations. If some guy comes and says that he's able to "jump to the moon" (or whatever) and all the people watching him believes that to jump to the moon is impossible, then even *IF-HE-MANAGE* to jump to the moon, nobody will believe him still after he has prooven it to be possible...

So if someone have a brilliant solution as to how we should help people in understanding that Managed Ajax Frameworks are way smaller than JavaScript Frameworks - in addition to all the other obvious benefits you get from Managed Ajax Frameworks. Then please let me know about it (in our forums) since I would really like Ajax to "win", and as long as people are struggling with JavaScript coding by hand - then Silverlight do have a more than fair chance of "winning" the "RIA Battle" - and throw us into another 30 years of lock-in, platform arroganse and EEE from MSFT. Even Microsoft themselves have understood this now!

Me and Kariem believes so strongly in the Open Web that we are willing to give away Ra-Ajax for free - in fact we *are* giving it away for free. Ra-Ajax is LGPL which means that you can use it for *free* in your own projects without putting constraints on your own source code, it's not even *POSSIBLE* to "purchase a license" of Ra-Ajax. You can use it for free in Closed Source solutions, in addition to (of course) also Open Source solutions. Ra-Ajax is *pure* FOSS and you can even fork it if you wish and create your own project out of our existing code base. I have even (in my early blogs) written 9 chapters in a book that describes every single deciscion we've done in regards to our choices of architecture and core design. This has been done in order to SHARE my knowledge about how to build great Open Web Ajax Libraries for ASP.NET and similar platforms. Not only that, but the content of that book (as well as every blog I've ever written here) is also "Open Source" (FDPL) which means you can copy and paste those chapters into whatever you wish, including your own commercial book for print if you wish! And in fact if some huge gigantic company came and "stole" our ideas and made money on them, I COULDN'T CARE LESS! I WANT you to "steal" my ideas! At least as long as it benefits mankind! I would be THRILLED of this could somehow manifest itself into a movement that takes the Open Web serious! That's what this whole thing is all about! Releasing the lock-ins we've had as developers upon ourselves for more than 30 years! This is my (and Kariem's) GIFT TO THE WORLD! And the world NEEDS IT! BADLY!


The sad parts


But currently unfortunately we're even on the .Net platform a "small" player compared to all the JavaScript Ajax Frameworks, which I think is a shame. Since if you're on the .Net platform there's absolutely no reasons what-so-ever, unless you "enjoy pain" - to use something which is not either Ra-Ajax, or built on the ideas from (or similar ideas as) Ra-Ajax.

OPEN WEB RULES! Help us get the Open Web to WIN! Start using Ra-Ajax TODAY!

Download Ra-Ajax NOW!


Have a nice day :)

Thomas


<< Previous - Comparing popular Ajax Frameworks in YSlow
LSP - Liskov Substitution Principle - To Be Or Not To Be - Next >>