This week, we are going to talk again about our programming libraries, to announce a good news: We added an optimization which reduces running time by about 40% and splits by half the quantity of transferred data.
Over the years, we offered more and more complex modules, with more and more features. Even for modules that we already offered in 2011, we added features regularly. However, a side effect of these numerous features is that the information that needs to be transferred by USB or HTTP has also increased in size.
Let's take for example the Yocto-Temperature. When we first offered it in 2011, we needed to transfer 464 bytes to refresh all the module attributes. Six years later, with the latest firmware on this same Yocto-Temperature, we need to transfer 756 bytes to load all the attributes. This difference is due to the many features which have been added over the years: the data logger, managing the different measuring units, the possibility to add a calibration, periodic callbacks, and so on ...
This increase in data to be transferred usually raises no issue because transfer protocols (USB and HTTP) are fast enough for the calls to the Yoctopuce library to last only a few tens of milliseconds. Moreover, the Yoctopuce libraries contain internal caches which prevent having to transfer data unnecessarily.
We have however decided to modify the data transfer protocol to reduce the quantity of data to be transferred.
This new protocol allows us to reduce the quantity of transferred data by a factor of 2 to 4, depending on the modules. This gain is the same whether the connection with the module is USB, HTTP, or WebSocket. Unfortunately, for technical reasons, the HTTP callback mode doesn't support this optimization.
This gain allows us to reduce the transfer time by an average of 40% "only", because the OS latency to establish the connection between the Yoctopuce module and the library stays the same as before.
Here are a few measures performed on different modules.
|Module||Previous protocol||New protocol||Gain|
|Yocto-MaxiPowerRelay||1320 bytes||377 bytes||3.5|
|Yocto-PowerRelay||481 bytes||133 bytes||3.6|
|Yocto-Temperature||756 bytes||195 bytes||3.8|
|Yocto-HubEth||4430 bytes||1820 bytes||2.4|
How to use this protocol
At the time of writing, this new protocol is available for the following libraries: Command line, Android, C++, C#, Java, and Python. The VisualBasic .Net, EcmaScript, and PHP libraries should soon benefit from the same improvement.
All the modules sold since 2015 are compatible
To use this new protocol, you only have to update your Yoctopuce library. You don't need to do any modification to your code, the new library automatically uses this new protocol if the module is compatible.
For the modules, it's even simpler. There is every chance that your module is already compatible. Indeed, all the firmware published since 2015 already support this protocol. Therefore, if you bought your module or if you have updated its firmware within the last two years, your module is already compatible.
As usual, we maintained backward compatibility. That is, whichever version of your module or of your library, your software continues to work correctly. If the library and the modules are compatible, the new protocol is automatically used.