Massive speedup to heatmap plugin (fixes #6756, #6691 and #6692)

Previously creating a heatmap using 100k points would process for several hours before crashing. I've tested these improvements and can now create a heatmap using 3.5 million points in under 10 minutes!