Reactive threading behaviour

Hi
I have some odd behaviour with the reactive nodes… may be a bug, may just be my poor understanding.

I want to parse a large CSV file but I don’t want it to interrupt my drawing.
I thought a perfect job for the reactive nodes to do in a background thread.

V1: when I set it up like this and click send I get a momentary freeze in framerate and my drawing stutters. I appear to get the result the next frame (although it’s a looong frame) which makes me think it’s happening on my main loop.

V2: when I add a delay to the event of zero seconds I get much better behaviour. I lose some FPS (but not a dramatic amount) for about 10 frames then the event returns. Which is what I’d expect from a background task.

This machine is a modest laptop Win10 x64 i5 with 2 cores.

If this isn’t a bug what’s happening here? How can I ensure a reactive event runs on a thread that isn’t mainloop?

hi toby,

the reactive nodes try to create as less threads as possible. so the ToObservable does not create a new thread by default. there is a parameter internally to set the scheduler but we have not yet published it.

for now you need to start a new thread with Interval or Timer, both create a new thread.

Thanks heaps!

Ah wait, is there a way to pass in a dynamic argument (other than the time) with observables generated by Interval or Timer? I think I need to pass in the path or stream of my CSV file in order to get it processed.

you can link into the region that needs it…? otherwise use ForEach or Project [Reactive]

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