Reactive Distinct - Should I heed the warning?

Hi, I’m in the middle of patching something with touch and I’d like to use the touch Ids to get back distinct touch inputs rather than some than the usual noisy feedback.

I saw the description mentioned above about ‘maintenance of an internal loop’ and I couldn’t quite parse it. Could someone explain it a little further, and what are the potential problems that in my scenario? for example, the Distinct node creates a new observable every frame. Should I be using it further down the observable/reactive node chain?

It will only become an issue if you expect millions of different touch ids. And watch out you’re using the “unwrapped” version (Observable category), those nodes are only meant to be called once to setup the computation, calling them every frame in an Update loop will not lead to the desired result because you would create a new computation all the time.

Should I wrap the Distinct node/region in a cache so its only created once?

Yes. Or place all the nodes in cache.

image

1 Like

@Elias To be clear here:

Reactive is an internal VL tool and does not need to be cached
Observable is an external tool and needs to be cached

Right?

Yes

1 Like