Android is an important target for JVM languages. Clojure should run well there
- Figure out what works and what doesn't
- Fast startup
- Small footprint
- Selectively strip metadata?
- Needs a motivated owner
- Be careful not to compromise Clojure for base and other platforms in making Android work well
- Will we need some sort of conditional compilation?
- Works out of the box with 1.2.0+
- But only with API level 8 (FroYo/2.2) and above
- API level 7 (Eclair/2.1) works if a work-around can be added for this bug
- API level 6 and lower fail during verification due to the bean function. Given that market share of these platforms is less than 10% and falling, probably a low priority to fix it.
- Startup time is a little sluggish, but not too bad
- The bean function causes some unnecessary GC and load time
- zip, xml, and set loading in RT.java add 1-2 seconds on to the load time (fixed)
- Average load time for a hello world app on stock clojure is 8-9 seconds using my macbook pro and the android emulator running Froyo
- Average load time for a hello world app drops to around 5 seconds with the bean function removed and zip, set, and xml removed from the load in RT.java
- Clojure adds =~ 4MB of overhead on application size (without any metadata stripped)
- Standard Hello Android on Java: 20.01KB
- Standard Hello Android on Clojure: 4.21MB
- Can be reduced using ProGuard to strip out unused namespaces.
- However, namespaces are cannot be broken up.
- Dynamic compilation
- It is possible to add, but it is slow
- Some forms fail to compile due to excessive stack use, e.g.
(for [x (range 5) y (range 5)] [x y])