the efficiency of jit.cellblock to store data that needs to be quickly retrieved

damien's icon

Hi all,

I've been using jit.cellbock to store descriptions of mgraphic drawing commands. For each frame, the required jit.cellblock rows are selected and sent to mgraphics. Each row contains the data required by 1 graphic element. I chose jit.cellblock because it was useful to have the data visible when developing the patch.

Max Patch
Copy patch and select New From Clipboard in Max.

Now the patch is working nicely, I noticed that the use of jit.cellblock for this purpose is not computationally efficient. For example, selecting 12 jit.cellblock rows @15 times per second uses 40% of my CPU. Can anyone suggest a more efficient method for storing information that needs to be retrieved in this fashion?

dtr's icon

I have a similar approach but using jit.matrix for storing the data. I'd advise to go that road. Have the actual data stored and retrieved in real-time in a matrix. That's gonna be much faster.
And if you want add a jit.cellblock to visualize and manually enter data. But don't query cellblock every frame. You could have a button that puts the matrix data into the cellblock (and vice versa) when you want to view or edit it. I never use cellblock but I bet it's easy to do that. So this way cellblock becomes an interface to the data stored in the matrix, instead of being the storage itself.

Darwin Grosse's icon

It's not going to be efficient because of the overhead of the display code. dtr is right - using a jit.matrix is the right way to go. An then to use the jit.cellblock, just connect the output of the matrix to the jit.cellblock and bang the matrix occasionally. You end up with the display that dtr suggests, but it only draws when you ask (or tell) it to update.

[ddg]