improving the sampling with cache sampling