NonMoving: Eliminate integer division in nonmovingBlockCount
authorBen Gamari <ben@smart-cactus.org>
Tue, 16 Apr 2019 18:32:40 +0000 (14:32 -0400)
committerBen Gamari <ben@smart-cactus.org>
Fri, 17 May 2019 17:02:44 +0000 (13:02 -0400)
commit1cde60c78ed1fb8b84b0359f2138fb8622f092ab
tree40cbccde5c95a458b692d57b3aeb59e68cac662b
parentf05efa484a700fd078506e2ebff910043050862e
NonMoving: Eliminate integer division in nonmovingBlockCount

Perf showed that the this single div was capturing up to 10% of samples
in nonmovingMark. However, the overwhelming majority of cases is looking
at small block sizes. These cases we can easily compute explicitly,
allowing the compiler to turn the division into a significantly more
efficient division-by-constant.

While the increase in source code looks scary, this all optimises down
to very nice looking assembler. At this point the only remaining
hotspots in nonmovingBlockCount are due to memory access.
rts/sm/NonMoving.h