Optimise sample visibility search.