I am integrating a Pd patch with an existing sequencer/looper (Seq192) with an OSC interface, where my patch should convert my MIDI controller's button presses to OSC commands and send back MIDI signal out to lighten the controller's LEDs.
I can retrieve periodically the status and details of all clips/sequences and aggregate it into a list of parameters for each sequence. The LED colors and the actions that the next button press will trigger depend on these parameters, so I need to store them for reuse, which I like doing with [text] objects. I am then handling buttons' light status in a
[clone 90] (where each instance of the clone handles one button).
This should be running on a fairly low-end laptop, so I'm wondering which of these approaches is the most CPU-efficient - if there is any significant difference at all - and I couldn't come up with a way to properly measure the performance difference:
[text define $1-seq-status]object in each clone, with one single line in each. I compare the new sequence status input with
[text get $1-seq-status 0]so that I update only line 0 with
[text set $1-seq-status]when I know that the content has changed.
- one single
[text define all-seq-status]object with 91 lines. I compare the new sequence status with
[ <button number> ( | [text search all-seq-status 0] | [sel -1] | [text get all-seq-status]
and if it has changed, I update a button's line with
[ <new status content> ( | | [ <line number> ( | | [text set all-seq-status]
The order in which buttons/sequence statuses are listed in the file might change, so I can't really avoid searching at least once per button to update.
- Should I instead uses simple lists in each clone instance? As far as I could test, getting a value from a list was a bit slower than getting a value from a text, but searching in a text was much slower than both. But I don't know the impact of processing 91 lists or text at the same time...
TL;DR: Is it more efficient to
[text get] and
[text set] 91 times in one
[text] object, or to
[text get] and
[text set] 1 time in each of 91
[text] objects? or in 91
Since you've gone through this long post and I gave a lot of context, I am of course very open to suggestions to do this in a completely different way :D