I've been playing around with clojure on the android platform.  To my
surprise it was pretty easy to get running, after removing the bean
method from the clojure.jar as hinted by Rich somewhere.   Of course
clojure code needs to be compiled AOT and eval doesn't work, as was to
be expected, but all seems to run fine otherwise.

There's a problem though, it's really slow..  I've played around with
the tracing tools of the android sdk and noticed about half of the
time spend is doing reflection related things.  Reflection on Android/
Dalvik is known to be slow.  At the top of the method list sorted by
exclusive times is clojure/lang/Reflector.getMethods with a 10% score
of total time spend, followed by java/lang/reflect/
ReflectionAccessImpl.clone, java/lang/reflect/Method.<init>,  java/
lang/ClassCache.deepCopy, java/lang/reflect/Method.getName and java/
lang/String.equals and java/lang/reflect/AccessibleObject.<init>.

My test case was pretty simpel; get the public-time-line from twitter,
parse it with xml/parse (needs a small tweak to work on android btw),
populate some struct-maps and display a listview.  Unfortunately this
simple task takes about 12 seconds to complete on a g1 phone.

So I setup *warn-on-reflection* and put type hints in all the
appropriate places but didn't detect any performance improvements.
Then I ran compile-clojure in the clojure source tree with an adjusted
compiler to see the reflection warning in the core.  This yields about
40 warnings and I wonder if fixing those will improve performance at
all.

Another approach is to try and speedup clojure/lang/
Reflector.getMethods by caching results.  Any idea's on what route
will get me the best results?

Thanks,
Remco
--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to