Hello Everyone,

I was at this pretty interesting meet-up yesterday where Sam Beran [1] 
showed how he achieved 30ms startup times on Android using Clojurescript. 
He was not hosting his app inside a web view, it was a native java app.

We all know and understand why clojure runtime bootstrap is "heavy" [2]. 
 It is definitely not feasible at all on Android, and I feel Sam is onto 
something here.

Sam took a round about way to solve this problem which I think is 
incredible.  I have requested Sam to write a blog post about this so that 
interesting rhetoric can begin.

Basically the approach is this: cljs -> js -> rhino [3] -> bytecode. 
 Provides java interop through rhino.  By the time things get to rhino, 
google closure has already thrown away most of the runtime away since we 
didn't use it, and we end up with manageable amount of JS which is compiled 
to manageable amount of byte code.   All of jvm is still available.

I do feel that having JS as an intermediate layer has certain disadvantages 
when we want to target jvm (e.g. threading), but overall I wanted to get a 
feel of what everyone thinks about this, may be insights into this as to 
why this is or isn't a great idea.   I understand that I am not doing 
justice to Sam's efforts here by mentioning it in just one line above, but 
I am hoping a more detailed blog post will help!

I have a feeling that this approach can do certain things for me and the 
Clojure community in general:

 - Makes it easy to sell adoptability to people, write code once, run on 
Web or JVM (what JS sort of does with node.js).
 - Fast startup times mean that we can write single shot command line apps 
and short lifespan programs, right now Clojure bootup is a major thing 
holding at least me back from doing this. "Oh man its takes forever to run".
 - May be we can figure how to convert existing investment and effort spent 
into writing Clojure libraries into this approach?

Looking forward to hearing back.

Relevant twitter 
thread: https://twitter.com/samberan/status/523929208595025920

Thanks,
Uday

[1] https://twitter.com/samberan
[2] http://nicholaskariniemi.github.io/2014/02/25/clojure-bootstrapping.html
[3] 
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/JavaScript_Compiler

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to