

SwiftKey's new Android Keyboard built using Clojure - benjamjin
http://swiftkey.com/en/blog/what-makes-clarity-keyboard-tick-clojure/

======
karmakaze
There's no mention of performance other than the load times. I love clojure,
but not if it slows down _anything_ in the input pipeline. Written with NDK
would make me happier.

~~~
AdamClements
Hi, I'm Adam Clements co-author of the article and tech lead on the Clarity
project.

The awesome thing is, I genuinely think Clojure has made this much faster than
it would have been if it were written in Java. Persistent datastructures and
immutability make threading _much_ easier to deal with, and so this has been
asynchronous from the start using the fantastic core.async to coordinate
everything. This means that in terms of raw responsiveness, it's really really
good.

Once it's compiled down and optimised (especially given that we're using
Skummet to bypass Var indirection in the production build) there really is
very little difference from Java in raw speed. Sure there are some pitfalls
and you need to know to avoid proxy, reflection, too many lazy-seqs etc. but
you need to know your language and work around bottlenecks whatever you're
using.

Add to this the obvious increase in development velocity, and the extra
stability you get from the reduction in side effects/race conditions/nil
punning from all this nice functional code, and I really think we're on to a
winner.

One nice example I think is how PersistentVectors allow us to send the entire
touch history around the system with every touch event, without incurring a
massive memory cost or having to build a whole new list every time. Compared
with normal Android MotionEvent handling code where everything that uses it
has to keep state, and make copies because the MotionEvent might get re-used
from under you etc. this has been an absolute dream to use for no performance
penalty.

~~~
karmakaze
I do appreciate all the developer-side advantages. None of which matter if the
final performance isn't as good or better. The article didn't give any
indication that this was the case and it good to know that you believe it to
be the case.

Haven't used Skummet and wasn't aware how efficient it can be made to be. How
is it on memory with the additional runtime?

