Efficient Variable Usage - ReUsage

makerprofaze

2015-08-12 01:32:18

I'm wondering about the highest precision usage of BMTP. I'm populating lots of LEDS, and I'm wondering which is the more efficient method - even if the difference is in milliseconds -and purely academic. Generally I use method 2, though if I have to rebuild/edit/duplicate, or I'm feeling lazy, I'll use method A for ease.

Example A
90 6A uu
90 6B uu
90 6C uu
90 6D uu

Example B
90 6A uu
90 6B vv
90 6C ww
90 6D xx

florian

2015-08-12 15:11:21

interesting question! The short answer is that every variable access takes the same time. The engine stores them as an index to a memory location -- writing to location 10 or to 25 will be the same. On CPU level, there can be differences for accessing memory location 10 or 25, but these are on several magnitudes smaller (e.g. picoseconds) than other factors which mainly determine MIDI timing (e.g. passing of messages from kernel to user space, up to a few microseconds). MT's entire processing of a MIDI message should not exceed a microsecond, but depending on if you're using rules.
Florian