Too much Javascript. #39

Closed
Dandandan opened this Issue Feb 26, 2012 · 9 comments

Comments

Projects
None yet
5 participants

Current version produces a all.js of about 375 kB data by default. Most of it isn't needed. Could it be solved by registering the needed functions and compile it with Closure Compiler?

Contributor

akoprow commented Feb 27, 2012

What do you mean by saying it isn't needed? Most of it is part of Opa's runtime, which will be used in all but trivial Opa applications.

I mean that only a few functions are used by the applications, not all of the 375 kB. Of course, the runtime is needed, but can be dumbed down to a few 10s kB or so when knowing the required functions.
For example, the app only uses $ select function, .show() and hide() from jQuery, only those are compiled.

For example, this (small) app using GWT uses only a 4.87 KB js file:
http://code.google.com/webtoolkit/doc/latest/tutorial/gettingstarted/StockWatcher.html

(But I think opa's concept is much, much better)

Contributor

Aqua-Ye commented Mar 4, 2012

About the closure compiler part, all.js is already closure compiled ;)

Yes, OK, but all functions are enabled :)

Owner

hbbio commented Apr 22, 2012

Indeed, we can perform a better code elimination for JavaScript (jquery itself, including with Opa js, is about 150kb).
Contributions are welcome - or we will begin working on this in about two months hopefully.

Are there any updates on this issue? Still seeing JS files with no fancy functionality weighing ~350kb.

Owner

hbbio commented May 6, 2014

We have greatly optimized the JS size. That said, Opa relies on some JS libraries (jQuery, etc.) that takes about 200kb. The cost is high for a "toy" but negligible for a real app. Note that you also can use lower level primitives to generate pages without the Opa stdlib by yourself and reduce the size of the JS.

hbbio closed this May 6, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment