inlining the reads and updates improves the timing.
can further inline the sums but bored right now :(