This patch react smartly to materials, making tha AO approx option really usable in interiors. It works on all devices (CPU, CUDA and OpenCL). Speedup vary between platform however. On the platform it was made on (OpenCL), the speedup is the best. From 1.5x faster for Classroom to 2x faster for the scandinavian interior from Chocofur.
Edit: removed things that were not related to code directly.