[PD] Sometimes all data-structures are redrawn

Roman Haefeli reduzent at gmail.com
Wed Mar 8 16:23:40 CET 2023


On Wed, 2023-03-08 at 14:13 +0100, João Pais wrote:
> 
> I just opened a patch with several jmmmp/multiarray and help patches
> of 
> several of my jmmmp objects using data structures, and didn't notice 
> something like that.
> But, I always use $0-names for templates.

When scalars are not overlapping, you don't see the redraw,  but you
still experience the lag. It seems the lag is proportional to the
overall number of scalars in Pd.

>  I would think having less 
> scalars for the same template would not affect existing scalars of a 
> given template.

My concern is exactly that the current behavior scales badly because
_all_ scalars are redrawn, not only the ones belonging to the affected
template.

> Is your test patch anywhere ready to test? (preferably not "go here
> to 
> download the whole library, then go there and do this, ect.")

Here a set of patches that aim to illustrate my findings:
https://netpd.org/~roman/tmp/illustrate-ds-redraw.zip

First open 01-illiustrate-redraw-with-many-scalars.pd. It will draw
1600 lines that are overlapping, so that the redraw is clearly visible.

Then open the other patches. Depending on how they are created, they
trigger a redraw at load time. Read the comments in the patches.

It takes exactly 3 seconds to redraw 1600 scalars on my machine. I
wonder if it takes longer on Windows (that's what some reports
suggest). 

> The delay on other gui objects is normal, is just pd overloading the 
> system with anything gui-related.

That's what I've been thinking for years and now I'm starting to
believe that the redraws are unnecessary and avoiding them could be
possible. What I'm struggling right now is how to create re-usable
abstractions that use data structures. Using $0 in struct names seems
to always force a redraw. So, I'm trying to find a way around that. If
replace all instances of $0 in a ds patch with a random number, loading
it doesn't trigger a redraw. What makes $0 special?

> It seems to me that gui peformance has gotten worse in 0.53.1, but I 
> haven't been using Pd enough to pinpoint it. If affects mostly GOP
> and 
> loading/closing speeds, maybe not related with this.

My subjective sense is similar, but I haven't actually verified it.
However, the lag caused by loading patches with data structures has
been bugging my for years, way before 0.53.1, I just wasn't able to
pinpoint it before.

Roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20230308/0195ca52/attachment.sig>


More information about the Pd-list mailing list