"destruk" wrote:
Another note -- the task thread is about 10 times slower than any other thread. So if you're downloading xml or json data to parse, use the task thread to do the things you require it to do - like use rourltransfer since that's the only way to do it within Scenegraph, and then as quickly as possible toss the result back to the calling thread to parse and process it. Speed is immensely improved doing this than having the task thread do the parsing and manipulation of what it received. When you have the data and have no need for the content field, be sure to unobserve the field, and then set the content field to "" or invalid so it is cleared for the next time you need it. AlwaysNotify for the content field of a task thread didn't appear to work for me - it always appears to be set to False somehow for task threads, ignoring callbacks for observers if the content is the same as it was prior.
<?xml version="1.0" encoding="utf-8" ?>
<!--********** Copyright 2015 Roku Corp. All Rights Reserved. **********-->
<component name="taskdownloaddata" extends="Task">
<interface>
<field id="uri" type="uri" />
<field id="content" type="string" />
</interface>
<script type="text/brightscript">
<![CDATA[
Sub init()
m.top.FunctionName="getNewData"
End Sub
Sub getNewData()
readInternet=createObject("roUrlTransfer")
readInternet.setUrl(m.top.uri)
temp=readInternet.GetToString()
m.top.content=temp
End Sub
]]>
</script>
</component>
I have noticed the slowness of the task also. So as you stated after the urltransfer was complete, i went back into the brs for parsing as I had always done before 7.6 hit my box. The parse will not run in the brs as it once did. It times out. So to stop the execution timeout I dropped the parse to a task. Big mistake. Absolutely takes forever but I see no other choice except maybe cut down size of data being pulled at one time, unless there is another way.