Move g.bezier.sum to g.math.sum + perf improvements

As shown by http://jsperf.com/array-reduce-vs-foreach/2 using a for
loop here is much faster than reduce.