Optimize iterator sums

These should all be eventually moved to algebird. For now, the biggest job is struggling with perf and this may help.