speedups in accumulation loops