**Bug introduced in V10.1 or earlier and persists through 11.2**

----------


Earlier [Kuba noted][1] a major slowdown with code Simon Woods posted.  Here is a simplified example.

First a color function using two different named gradient schemes:

    fn = ColorData[If[# < 0.5, "CoffeeTones", "DeepSeaColors"]][#] &;

Now its use to colorize a random array:

    Colorize[
     RandomInteger[99, {100, 100}],
     ColorFunction -> fn
    ] // AbsoluteTiming

![enter image description here][2]

This is conspicuously slow for such a simple operation.  Interestingly this has *nothing* to do with `Colorize` or how it uses `fn`; it is inherent to `fn` itself:

    fn /@ RandomReal[1, 100^2] // AbsoluteTiming // First

>     4.746

What's going on?


  [1]: https://mathematica.stackexchange.com/questions/76449/coloring-an-image-with-two-color-schemes-based-on-a-range/76471#comment207947_76463
  [2]: https://i.sstatic.net/WVI84.png