Hi Jeremy, in my experience, as soon as I hear myself say ‘the problem is that XYZ is slow’ I now immediately stop and verify that that is actually the bottleneck, as in my experience, it rarely is. My intuition (and most of the people I know have awful intuition around performance). You might be different, I have no idea :-), but my first piece of advice is to validate that statement.
For example, rather than loading a game just use the exact same JavaScript but don’t start the game, instead display an ‘I am loaded’, now launch the same collection of iframes, is it still slow? If so then yes, that is your problem, if not then it is elsewhere. One technique I usually do is have the backend return a HTML page with a literal timestamp (generated by the server) in it and then have the very first thing the JavaScript do is print the current timestamp - I can then see exactly how long the JavaScript loading took place. Apologies if there is ‘teaching to suck eggs’ going on, but that would be my first place to look. Other questions: - are you using :advanced compilation as I found that was a nice little ‘go faster’ injection. - do you have one atom which every iframe is sharing (ages since I used iframe but I understand they can’t access the same JavaScript space so I guess not)? - exactly how much time does one iframe take, how much time do all the iframes take - how many iframes - how big is the compressed JavaScript file(s) - iframes - really? :-) (and if it isn’t clear I would be amazed if the bottleneck on a collection of iframes each running games was the _loading_ of the JavaScript :-)). HTH. > On 26 Sep 2015, at 12:53 PM, Jeremy Vuillermet <[email protected]> > wrote: > > Hello, > > My app is composed of multiple mini games. Each of them is loaded in an > iframe and have their own server. > > The majority of them are written in clojurescript/reagent. > The problem is that loading the javascript is slow and very slow on mobile. > > I'm trying to load only few games and then load the others on demand but > that's also a problem because I need to be able to switch games quickly. > > I just feel the root of the problem is I don't know how to share the commons > lib. Ideally (I suppose) I would serve google closure and other common libs > only once from the main app and the others iframe could use it or at least > cache it. > iframes are on the same domain sub/domains. > > Any idea on how to speed up the load time ? > (maybe the iframe is a bad idea and I would like to discuss alternatives) > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/clojurescript. -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
