mapbox/mapbox-gl-js — pull request #881 by michaelsteffen (2014-12-11 05:15:45+00:00)
Title: Preprocess class styles in cascade

Continuing along the lines of #831, this moves more preprocessing of style declarations into cascade() from cascadeClasses(), to avoid redoing this work each time a class is changed. On my Mac, this gets me another 3-6x speed improvement: cascadeClasses() is down to < 15ms for me in most situations.

This allows class changes to be used for pretty smooth interactivity and animation, like [this little visualization](http://michaelsteffen.github.io/rides-gl) I've been playing with (GPX traces of bike rides around Houston). It should be easy to see the improvement in responsiveness compared to [this version](http://michaelsteffen.github.io/rides-gl/old.html), which is identical but uses mapbox-gl-js 0.4.2, or the [Urban Layers visualization](http://io.morphocode.com/urban-layers/), on which mine is based.

These changes moderately slow down cascade(), since all layer paint properties are preprocessed (vs. just currently active classes), but hopefully a small delay is tolerable on changing the map stylesheet, and is a small price to pay for very fast subsequent class changes.

Also fixes #789.