-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reused parameters and algorithms #32
Conversation
This reverts commit 5cf7fa1.
Thanks for these explanations, I'll try to review this week. |
Changing default behavior is probably the cause of the fail of the unit test |
Fixed
Defaults are not the same only for CRC32, for other CRC types defaults were correct |
Found a few hours to do a comparison test with ESP32 and UNO using the CRC_performance.ino example. For ESP32 things look just fine, UNO (AVR) pays a serious penalty. Arduino UNO (16 MHz)Compile size
The 1.0.0 version has a larger footprint (for UNO this is substantial). Runtimes
ESP32 (240 MHz)Compile size
Runtimes
|
Hmm, only one serious difference I see. Perhaps it's an issue. In 1.0.0 we use common type for length/size What if use custom type for size:
? |
For binary size of UNO perhaps compiler/linker for avr doesn't optimize code as gcc for esp32. We can remove FastCRC32 and check if binary size become less |
Manually removed the FastCRC32 gave the same binary size. So that works well. No time today to do the size_t test, maybe later this week. |
Let's check it. I'll prepare commit with crc_size_t today |
I see. We left a lot of deprecated functions and methods:
That why binary size is higher. After removing them I think binary size should be less even than 0.3.3, because we reuse a lot of code in 1.0.0 |
In stddef.h of UNO:
|
Quick test in my coffee break, disabled the deprecated functions and patched the test 6018 ==> 5894 versus 5184 (0.3.3) |
I think that for Binary size will be lower than 0.3.3 when we use functions and classes. For this moment cant find solution to not duplicate code and not reuse classes. Have an idea? |
Not sure if we should consider CRC_reference_test result for that, because it uses all possible CRC functions in one test (binary). For CRC32_test binary size is 2450 (library overhaed ~2000 bytes) for ver 1.0.0. CRC32_test for ver 0.3.3 has binary size 2708 |
Quick check latest version => CRC16 has improved a lot, others are (nearly)identical to previous 1.0.0 Good step forward
|
Next possible issue that I see:
We call add() each time instead of direct calculations in 0.3.3. Method calling can cost Maybe change:
as inline function? |
Lets prepare small check before. Changed |
I bought a board in order to check. Changing functions to inline doesn't help.
to:
calculation time was decreased from:
to:
Hmm, |
Could be an AVR issue, |
Lots of work piles up, so sorry this one does not get attention. |
What was changed:
CrcParameters.h
where all CRC parameters will be stored instead only polynomes. Reused this param constants everywhere.CRC32
class andcrc32
func now use default CRC32 paramsyieldAdd()
methods andyieldCrc..()
functions instead yeald by defaultcrc..()
functions now use the same codebase as classesFastCRC32
based on lookup table for default CRC32Proposed to change:
getCRC()
methods tocalc()
orcalculate()
crc..()
functions tocalcCRC..()