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>
Wed, 19 Jun 2019 01:42:04 +0000 (21:42 -0400)
commit934c48eed6772ccd3cc1b3e3fc322cb556b43a30
tree58f05cf8755e3f5052549f3f13045eb2cc727f17
parent1a125cc6042660167a39a4750bebdbfa81e50441
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