Early exit strategy for SSAO?

Hi everyone,

I’m working on an SSAO implementation. I’ve had an idea to speed it up by having AO fragment shader finish faster for fragments that are not occluded (depending on the scene, this can be a significant portion of the screen in my case).
I tried a naive approach first: if, after the initial four samples the occlusion is still zero, we exit. This results in a significant speedup, but the quality deteriorates badly: the occluded portions become very noisy.

I was wondering if anyone else has attempted a similar optimization. Is there a better way to approach it?