RobTillaart / Fletcher

Arduino Library for calculating Fletcher's checksum
MIT License
4 stars 2 forks source link

0.1.4 #9

Closed RobTillaart closed 2 years ago

RobTillaart commented 2 years ago

@daniel-mohr I'm preparing a new release 0.1.4 with your optimizations. It is in the develop branch, I also added your optimizations to the stand alone functions. The fletcher16() is not updated as it seems to conflict with the optimization to delay the modulo part as long as possible.

Before releasing 0.1.4 I want to try if the optimizations work at least on a ESP32.

RobTillaart commented 2 years ago

@daniel-mohr

The ESP32 is definitely faster too, so I will add it to the #ifdef condition. As I expect the ESP8266 to be faster too (also 32 bitter) I add him too. (opportunistic I know)

Fletcher32_performance   (old method)
randomtime: 6945
     total: 9274
 1e4 x add: 2329
  checksum: 886350356   

Fletcher32_performance  (optimized modulo)
randomtime: 6947
     total: 8577
 1e4 x add: 1630
  checksum: 233217780  (as we add random values this happens).
daniel-mohr commented 2 years ago

I asked myself yesterday if it is really necessary to calculate with 16 bits if we only need 8 bits. And I think I found a solution. At the moment I'm not sure if it is faster. Let me see first.

If so, should I provide a new PR based on develop?

RobTillaart commented 2 years ago

As the ESP32 tests were successful I will merge develop into master asap and label a 0.1.4 release.

Better build your new PR on that one (functional identical)

RobTillaart commented 2 years ago

0.1.4 released,

RobTillaart commented 2 years ago

I asked myself yesterday if it is really necessary to calculate with 16 bits if we only need 8 bits.

May depend on the native / internal format of processor what is faster.