Skip to content
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

Use littlefs' version for all CRC-32 computations #343

Open
PatrickKa opened this issue Jan 25, 2025 · 0 comments
Open

Use littlefs' version for all CRC-32 computations #343

PatrickKa opened this issue Jan 25, 2025 · 0 comments

Comments

@PatrickKa
Copy link
Contributor

Description

We initially chose CRC-32/MPEG-2 because we thought that is what the HW-CRC unit of the STM32 computes. As we found out, that is not the case. It does something completely weird, which basically renders it useless. Therefore, we are free to choose again. Since littlefs already comes with a CRC-32/JAMCRC implementation, that is much smaller than ours (16 instead of 256 words in the look-up table) we will of course settle for that one.

I was also, curious whether there is a speed difference as well so I ran a quick benchmark. The checksum of a vector of 100 MiB filled with random numbers was computed on my laptop. Our CRC-32/MPEG-2 implementation took ~2400 ms, while the CRC-32/JAMCRC of littlefs only took ~540 ms. That's 4.4 times faster! I don't have data for the STM32, but I am sure the littlefs version is also faster there, even if the difference might not be as dramatic.

Here is an online calculator that can compute and compare many different CRC-32 variants.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant