I found a optimization, You can use 65536 + 2*_dimensions instead of 512 * 1024 / 8 + 2*_dimensions.
Are you actually joking?