jit.gl.sketch drastic fps slow down while drawing

visualpaco's icon

Hi all,
I experience an incredible slow down of fps using the sketch obj to draw lines made by giving an input of the x & y position from an external device and so receiving many bangs in real time when the capture device is active.
I would like to kindly understand the logic behind the "drawing" process in jit.gl.sketch which I suppose is involving, in the gl3 example patch attached, the following messages: [beginstroke basic2D] [ strokepoint $1 $2 ] [endstroke]
Is there a procedural order among these 3 msg (or with other messages involved)?

What I do, to obtain a drawing solution, is to send many bangs to the first two messages (beginstr. and strokep.) when my device is sending the xy position and send a bang to [endstroke] when inactive.
I can draw but then the fps in the world object slows down drastically after leaving just few lines as in the pic attached. You can simulate that in the patch attached simply changing the dimension of the noise matrix.
Do you have any idea of what's wrong with my idea of jit.gl.sketch?
It looked to me to be a problem of cpu used by Max to store all the stroked points data but the ram looks working at 24%. Gpu at 4%. So I really get stuck :/
It would be awesome to find a kind answer!
Thanks in advance!

image from "drawing" process - each "line" produces a significative slow down of the fps (such bad lines... forgive please)



gl3.sketch.commands_reduced.maxpat
text/plain 17.15 KB
Gl3 Sketch Commands example with some changes