I had a similar idea a while back which I called "compact" mode. It would just 
concatenate all files into one big JS file that would be included in the page. 
To my surprise this wasn't much faster. Turns out that loading a 6MB JS file 
(:none) is not much faster than loading 50+ smaller files. Browsers are pretty 
good at loading things in parallel.

However your idea intrigued me and I implemented it in shadow-build [1]. I see 
only a very tiny gain in overall performance (1.7s vs 1.9s load time). I am not 
using much of Closure though so YMMV. What is a bit annoying though is the 
source-map issue (same reason I eventually abandoned "compact"), by which I 
mean that you'll no longer get an error in "goog/some/thing.js line:30" but 
"my.js line:51234". You could generate a proper source-map for all of it I 
guess but I'm not sure it is worth the trouble (and adds considerable compiler 
overhead).

Long story short: The "download" may actually not be the slow part, executing 
"hundreds of closure library files" might be. Are you sure that you need to 
load all of them all the time?

Are you using :main? Have you tried :modules? Both potentially limit the files 
you need to load.

I'm happy to walk you through shadow-build if you really want to test this for 
your project.

Cheers,
/thomas

[1] 
https://github.com/thheller/shadow-build/commit/c06fd6544cee5605d0ba8e32a1114919102a10bd





On Friday, January 20, 2017 at 5:09:54 PM UTC+1, Justin Ratner wrote:
> We have a fairly large project in which we require a good bit of closure 
> library functionality. While developing with :optimizations :none, hundreds 
> of closure library files are loaded when the page loads. This means that the 
> page takes 7-10 seconds to load. That doesn't seem like much, but when you 
> are refreshing the page many times while developing (I don't always trust 
> code-reload), it adds up.
> 
> Most of the time is spent waiting for browser connections to open up, so the 
> next file can be downloaded. Most browsers can only download a handful of 
> files from one domain at once.
> 
> Wouldn't it be better if the closure library was served in a single js file?

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to