onaio/zebra — pull request #756 by prabhasp (2014-10-01 09:27:28+00:00)
Title: 498 map performance

Reduced performance by being smarter about data consumption.
* `geojson` data is way smaller now, only includes `_rank` and `_id`, not all the data. It is also never converted to cljs objects, since the only thing that needs to read geojson is leaflet, so the data goes directly to js.
* mapview also uses (non-geojson) `data` object along with the tableview. This was being converted using `js->clj` before, and now its converted by `transit-cljs`; the latter is MUCH faster.
* the form is still converted to clj via js, but it hardly matters, because the form is MUCH smaller than data where performance matters.
* map and tableview share the "ranking" operation on the data.

Testing on a local html version of form 2971 (so the server-side latency is gone), the pictures changes like so:

**Before:**
![screen shot 2014-10-01 at 2 39 28 pm](https://cloud.githubusercontent.com/assets/178868/4472884/8076e2b4-494c-11e4-9aa2-b2a264c2f4fe.png)

**After:**
![screen shot 2014-10-01 at 2 39 40 pm](https://cloud.githubusercontent.com/assets/178868/4472885/80ca43f0-494c-11e4-977d-8388a1f29822.png)

Notice that now most of the time is taken up by the leaflet `feature-layer.addTo(m)` call, rather than data conversion. Data conversion does take about a second, but we are dealing with 2900+ points here. Plus entire chunks of high CPU activity are gone because of better code organization.