As noted by @kronick, evaluation of functions with the regards to the number of stops is more expensive that it could be — we're looping through all stops for each value. Instead:
categorical functions could use a hash to improve from O(n) to O(1)
interval and exponential functions can use the fact that stops are supposed to be sorted —using binary search to improve from O(n) to O(log N). I used a similar trick to optimize feature-filter.
https://github.com/mapbox/mapbox-gl-function/issues/31