clojure.pprint/cl-format is slow
Had a serious performance problem last week. After some digging we narrowed it down to a call to cl-format.
Some test code to demonstrate the discrepancy:
With the following results. For the simple case, cl-format is 10 times slower than a simple string return. For more complicated format strings, closer to 100 times slower:
Having a quick look at the implementation of cl-format I immediately noticed a compile-format function which seems like something that might help out with performance for many calls to a cl-format with the same format string:
Compiles format-str into a compiled format which can be used as an argument to cl-format just like a plain format string. Use this function for improved performance when you're using the same format string repeatedly
It also seems like cl-format will check if it's format string is already compiled and skip compilation if that is the case:
Oddly however, compile-format is not public, so I can't use it. So I am left a little confused. I am going to do some more digging tomorrow to solve this mystery as I am sure I am missing something here.
Not sure if pre-compilation will help solve the horrible performance you get from cl-format, but I am guessing it might help.
After some discussion with my colleagues, it seems I haven't missed anything and we think this is a bug.
Decoding Polylines from Google Maps Direction API with Clojure
My first crack at porting some imperative code to Clojure goodness.
I needed some code to turn the polyline points encoding you get back from Google Directions API. This stuff:
I found Jeffrey Sambells' Java code here that does the job. I am just getting my teeth into writing Clojure for my day job at GoCatch, so I need a Clojure version. This is my first attempt. It's midnight and I haven't had a chance to check the line ends up on a map correctly, but it looks pretty good to me:
Hundreds Chart Dev Diary
I've had this idea for a game to teach kids times tables since I finished Wordflight two years go. I got bogged down in my initial implementation using OpenGL ES and a few weeks ago I decided to re-boot the project with flat UI, vivid colours and UIDynamics to make things interesting.
This time the project took two solid weekends (and a few late nights), but I am pretty happy with how it turned out
If you are reading this and you live in Australia, make sure you check out goCatch next time you need to catch a taxi.
Interactive Hundreds Charts
Four engaging math games to help children learn their multiplication tables.
Just another places API data glitch that I needed to write down somewhere. The auto complete results for "Royal Randwick" has the suburb as "Randwick" which is all good:
The corresponding detail response has "Sydney" as the locality. Accurate but imprecise ;)