[PD] Data structures - delete specific scalar?

Ingo Stock mail at ingostock.de
Sun May 20 02:00:32 CEST 2018

Thanks for your testing!

The lag appears on my computer already with the patch i sent with the
1050 scalars. It shows when i open the patch, create any object, say a
[float] and try to move it around.

With more scalars it can become even worse. You can test it with the
attached patch. First select width and height and then click create. It
creates a rectangle made of width x height one-pixel-scalars.

With about 100 x 100 pixel, clearing the patch becomes increasingly
slow. With 640 x 256 pixel, it took more than nine minutes on my
computer to clear the subpatch or even to close the window, so be warned! ;)

The reason for the lag is afaik, that all interface objects are
constantly redrawn by Tcl, so it is not limited to scalars.

best, ingo

On 05/19/2018 11:23 PM, Roman Haefeli wrote:
> On Sat, 2018-05-19 at 17:00 +0200, Ingo Stock wrote:
>> On 05/19/2018 11:56 AM, Roman Haefeli wrote:
>>> Yeah. It's not very elegant and gets expensive pretty quickly. I
>>> was
>>> wondering about alternative strategies, like moving non-used
>>> scalars
>>> out-of-the-way and later re-use them. It's cumbersome to implement,
>>> but
>>> probably less drastic than the clear-all-and-rebuild method. 
>> Can only answer to this: There are several methods to make scalars
>> invisible. Anyhow, in my experience the method to clear the subpatch
>> and
>> recreate everything works quite well and is imho the clean approach
>> to
>> do it, as all the scalars are redrawn every frame any way.
>> There are other limits to the use of data structures. Depending on
>> your
>> computer, when you get above 800 scalars or so, the patch becomes
>> laggy.
> Thanks for your considerations. That is exactly the kind of info that I
> was looking for. I don't share the experience with the limit of 800,
> though, but this is presumably related to the computer/CPU.
>> Consider the attached patch:
> Nice and illustrative example patch.
>>  On load 1050 scalars are created, which is
>> already quite heavy on my computer. 
> I'm not sure I understand correctly. Just having the patch open is
> heavy on your box? Or interacting with it?
>> Anyhow, deleting a scalar by
>> clicking on it works fine, using the clear and redraw method.>>
> It works fine for me, too. Then I measured the time it takes to redraw
> different numbers of squares. It seems computation time is roughly
> proportional to the number of redrawn objects (1: 0.08ms, 500: 3.9ms,
> 1000: 7.6ms). So there is a penalty of this method with larger numbers
> of scalars.
>> Hiding scalars by making them invisible doesn't help with the lagging
>> problem. Therefore i would recommend the clear and redraw method any
>> day. ;)
> I don't experience any lags by making specific scalars invisible. It
> takes 0.007ms to make a single scalar invisible within a subpatch of
> 1050 squares. See my modified version of your patch.
> Roman
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pixelgrid.pd
Type: text/x-pd-l2ork
Size: 3935 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20180520/bff25325/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20180520/bff25325/attachment.sig>

More information about the Pd-list mailing list