Making "read from file" less blocky.

Jerry Jensen jerry at jhjensen.com
Sat Aug 3 23:23:34 EDT 2019


Memory returns slowly… 
I take back what I said about eof maybe working for serial ports. I’m pretty sure it doesn’t. When I did this before I was taking data from 2 incoming asynchronous serial ports, one then the other then repeat. They only had tiny buffers, so I had to read small pieces of data from each with minimum delays between. When nobody was talking I handled the accumulated data. 

It it is!
.Jerry

> On Aug 3, 2019, at 8:02 PM, Tom Glod via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Jerry, that simple tweak worked to improve the performance of the UI a
> great deal...... its a slower method of loading...........but not too slow
> to use as background loading. ...Its actually better than what I
> expected.   Awesome.
> I always love to use the forever loop..... its just so fun to write. lol
> I gotta get some error handling in there but thats another story.
> Consider this one SOLVED. Thanks again.
> 
> 
> 
> On Sat, Aug 3, 2019 at 10:47 PM Tom Glod <tom at makeshyft.com> wrote:
> 
>> Dar, Yes...I understand.....it is a blocking operation no matter what I
>> can just introduce breaks in the blockiness.  So I'm not expecting a socket
>> like experience for sure.
>> 
>> Those are very good suggestions to try.... thank you.
>> 
>> Jerry, I will give that a try, it looks promising.....even a little
>> improvement would be better and sufficient for this need, and I can use it
>> sparingly.  Thanks alot!  Onward indeed.
>> 
>> On Sat, Aug 3, 2019 at 10:36 PM Jerry Jensen via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>> 
>>> Hi Tom,
>>> 
>>> I’ve done this in the past watching it instead of the result. I seem to
>>> remember eof was not useful. Maybe for a serial port it would be?
>>> 
>>> As in:
>>> 
>>> repeat forever
>>>  read from file ThisFile for (1024 * 1000) bytes
>>>  if it is empty then exit repeat
>>> — do your stuff
>>>  wait 0 with messages
>>> end repeat
>>> 
>>> Onward,
>>> .Jerry non-sphere (tetrahedron?)
>>> 
>>> It was a long time ago in, I think, LC 5, so YMMV.
>>> 
>>> 
>>>> On Aug 3, 2019, at 5:56 PM, Tom Glod via use-livecode <
>>> use-livecode at lists.runrev.com> wrote:
>>>> 
>>>> Hey folks,
>>>> 
>>>> I'm having trouble finding a combination of settings that allows my file
>>>> loading  to seem to happen in the background.
>>>> 
>>>> repeat while read_result is not "eof"
>>>>        read from file ThisFile for (1024 * 1000) bytes
>>>>        put the result into read_result
>>>>        put it after IntoThisVariable
>>>>        add length(it) to amount_read
>>>>        TSTProgress amount_read,ExpectedSize,"%","Loading File ..."
>>>> (Progress Indicator Handler)
>>>>        wait 10 milliseconds with messages
>>>>     end repeat
>>>> 
>>>> no matter what I try, its still sluggish, and it seems like messages are
>>>> still accumilating instead of being processed by the engine.
>>>> 
>>>> Am I missing something?  Normally waiting with messages sufficiently
>>> frees
>>>> the engine to allow the UI to remain responsive.
>>>> 
>>>> Thanks,
>>>> 
>>>> Tom
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>> 
>>> 
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list