B4A Class Performance efficiency of AsyncStreamText object

Discussion in 'Additional libraries, classes and official updates' started by DDL, Nov 28, 2014.

  1. DDL

    DDL Member Licensed User

    How much is the additional overhead of using an AsyncStreamText object to get incoming streaming messages? I am receiving text from a Bluetooth device that is continuously streaming messages (with end of line characters) at 9600 baud. If I use the AsyncStream_NewData event then I get respectable, almost real-time display of the raw streaming text when logging in debug mode or to a label in my main Activity screen. If I use an AsyncStreamText object to get each message there is a substantial delay of several seconds before each message appears in the label.
    I used Erel's AsyncStreamText example with minimal modification: I edited the AsyncStreamText class function to log the results of Astreams_NewData() within the AsyncStreamText object. The logging from within the class function seems a little slower. And the time taken for the text messages to appear in the label is even slower by several seconds.
    If use an AsyncStream object (instead of AsyncStreamText) and parse the data myself, looking for end of line characters, I can get near real time response (both in logging and in appearance in a label). It just takes me a few lines of code to check for end of line characters. Which makes me wonder what is the additional overhead of using an AsyncStreamText object? Is it the CallSubDelayed() function that is delaying the messages? Or should I be using some other approach for streaming text. I don't mind losing a few data packets, but I need as close to real time display as possible.
    Thanks, DDL
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    AST should'nt add any significant overhead. Test it in release mode.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice