Fastest way to setslice

SetSliceTest.vl (44.3 KB)

I’m working on a generalised led mapper, everything is fine if all fixtures are contiguous, but if I allow for gaps in the addressing layout or to allow changing the order/address of fixtures (and coming from real world installs, this often happens) I need to setslice / setspread into dmx channels for large amounts of universes. ( I also try and target lowest possible CPU usage in general for installs for energy reasons )
My backup plan is to create padding pixels on the GPU, but this would be a problem if the padding isnt in 3channels (rgb) counts, so imagine a 1 channel gap between the end of one fixture and the start of the next.
This patch demos setslice versus setitem in a dictionary. Dictionary comes out on top, but is there another option that I am missing, as dictionary is still slower than I’d like. Getslicing to go from one big spread to multiple universes at the end is much much faster.

TLDR: use spread builder, which is mutable and a SetItem will just set one element. Spreads are immutable and every operation that changes it will create a new spread.

SetSliceTestMutableArray.vl (58.9 KB)

from the chat
seltzdesign
I can really recommend watching: VL.ExtendedTutorials Mutability in vvvv Gamma (Record vs Class) - YouTube Toby explains it really well and I finally “got” it after that. Any time you use Spread you cache it, but only if it rarely changes, like your start addresses. Otherwise spreads get regenerated every frame, which then also triggers your cache regions below every frame. You don’t really need a dictionary if in the end you only use the values. I guess mutable array would be the right thing.

So just converting to mutable array, gives a big performance increase. Maybe I will compare spread builder next if I can work it out…

SetSliceTestSpreadBuilder.vl (68.1 KB)

And Spread builder is the winner

Using set slice with these counts its over 1million micros seconds, vs, 140 with spread builder (and everything cached) … Dictionary uses 60,000 and mutable array 18,000. As comparisons…

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.