Reducing number of cpu cycles while sending lots of data



  • In my nesting-box project i have the case that i need to send a lot of data over the nrf24-link.

    The normal mysensors way of sending the data would be to define a message object outside the sending loop and then set the payload in the loop followed by a send.
    The actual "problem" with this is, that a call to send will each time set the last, sender, destination, version, command and requestack.

    To speed up i declared to methods "prepareSend" which sets all the stuff to the message object and a "send" method that just takes the message object and straight call radio.send.

    Pro: Properties of Message can be set one time -> faster loop
    Contra: Routing changes etc. will have no affect in the loop.

    What do other developers think of this, and is it maybe worthy to also implement it for real?


  • Mod

    I guess it depends... How much difference does this make in real throughput?

    Doesn't the OTA stuff use som sort of stream concept? Maybe that is a good solution for your data as well?



  • My memory says: 5kb/s without modification and arround 20kb/s with modification.


  • Mod

    @Oitzu said:

    My memory says: 5kb/s without modification and arround 20kb/s with modification.

    Nice. Not fantastic, but a pretty ok speedup.



  • @mfalkvidd said:

    Doesn't the OTA stuff use som sort of stream concept? Maybe that is a good solution for your data as well?

    I don't know about the MYSBootloader 1.3 but the old one was more like a request <-> answer thing of blocks, this is fine but not very fast and not very "streamy" ^^

    @mfalkvidd said:

    Nice. Not fantastic, but a pretty ok speedup.

    Well it was enough to have a reasonable transfer time. There are still more things someone could do to speed things up.
    By example: Disable the auto-ack and send more then 24bytes at a time. (Keeping radio on and send multiple packets)
    But thats all a little bit more complicated with the mysensors lib.



  • Also contra: no signing


Log in to reply
 

Suggested Topics

  • 1
  • 3
  • 6
  • 10
  • 5
  • 2

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts