Async VL drop frame and sporadically freezes

This is probably caused of bad implementation or bad understanding of Async usage and functionality.
What I am tending to do is to read a string file (txt) and split it first in to lines and then in separated fields (split string).

In order to do so first I do an HTTPRequest with HTTPGet and then pass the result in my VL node.

First thing is I have a huge frame drop even before I press “restart” the AsyncLoop and if the load is huge (raw lenght is 15763575 bytes) it freezes.

I noticed this because I also tried with Stream and I had the same exact behavior.

I think that none of the VL’s girlpower examples fit my needs to replicate it really and there are obviously some things that I completely missing in VL for sure.

Something like this, where it’s a one-off rather than continuous action, might be better handled with AsyncTask. It should put the task on another thread to do your read/split stuff. With AsyncLoop what you do is get all of the available processing resources to do that task, which is why the resources running vvvv are being swallowed up too.

If I have it right, Async task may actually take a little longer to execute this task, but you shouldn’t see it affecting the rest of the program, or at least to a very reduced amount.

You probably don’t need to store the text in the upper pad called StringData either.

Template-Template-As%20AsyncTask

1 Like

as guest said, AsyncLoop is for continuous execution of whatever happens in the region, uncoupled of the mainloop. I guess it could be set legacy already, since it was just a quick proof of concept, and tebjan has implemented the much more userfriendly ForEach (Reactive) together with the various timers.

one reason for your framedrop might actually also stem from those 15mb of strings, which i guess you pass from the HTTPGet node (VL) to vvvv (delphi ) and back to vl. string pins are actually quite expensive and it will probably allocate those 15mb at least twice (for each plugin), which puts pressure on GC.

since AsyncTask is the way to go, you should peek inside the HTTPGet VL node, to see how to get started. there is already an async task inside. you should actually just copy paste the bunch and do the string operations already inside that region directly on the responsestream to get optimal performance.

2 Likes

@woei so is it possible to load a VL patch in another VL patch (for instance to put HTTPGet in my main VL patch) ?

how do you mean, load a VL patch in another one? you basically have two options, add the other document as a reference and use all nodes that are defined in it or copy the content of patch into yours and integrate/modify it.

see here under “Files”: https://thegraybook.vvvv.org/reference/hde/navigating_a_project.html

1 Like

@tonfilm thx, on my way !

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