I’d avoid any UI objects (as matrixctrl for instance) in that kind of stuff.
Indeed, Max for Live is running with the Scheduler in Overdrive mode and using UI in that case (and specifically when you feed UI on high rate of message) can suck CPU a lot.
for reference:
Overdrive
When Overdrive is enabled, Max gives priority to timing and MIDI processing over screen drawing and user interface tasks such as responding to mouse clicks. As a general rule: if you are primarily going to be using Max for MIDI or audio processing, Overdrive should be enabled. If you are primarily going to be using Jitter, Overdrive should be disabled. In addition, the debugging features of Max only work if overdrive is disabled.