Optimize sensorimotor temporal memory

Counterpart to https://github.com/numenta/nupic/issues/1410.