improved Gaussian Grid performance
(cherry picked from commit ce717ba)
further improved Gaussian Grid performance
(cherry picked from commit d5c3d52)