-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
move crc32c interface into stdlib #24235
Comments
Oh, I see what you mean. Base wouldn't export anything. The CRC32c module in stdlib would just import |
Do we actually use this in Base anywhere? |
@StefanKarpinski, yes, it is used in loading.jl for validating cache files. |
Actually I'm not sure it's worth making an stdlib package for this. The whole thing is <50 lines of code; there's almost more doc string than code. |
Then should we just unexport it and only use it internally? |
Checksumming is a pretty generally useful thing to do; it would be a shame to keep it to ourselves as a private undocumented function. |
A trivial stdlib package (that just contains the exports, not any actual code) has the advantage of making this function available, while not tying Julia itself to the API. (e.g. if we someday switched to a different checksum internally, then the code for CRC-32c could be moved entirely into the package without breaking anything.) |
I don't disagree that it's useful, but it makes much more sense to have larger packages that provide various related checksums with consistent APIs. In fact, there already are multiple such packages: https://github.com/andrewcooke/CRC.jl, https://github.com/fhs/CRC32.jl. The very minimum thing we could do is unexport it and document it as something that may change in the future in 1.x. |
Yeah that's fair, I guess a trivial wrapper package for the sake of removing the export makes sense. |
(None of the other checksums is hardware accelerated. In consequence, there is a pretty good argument that this is the only 32-bit checksum you should ever use if you have a choice. This is also why the Base/stdlib function is valuable to expose/document: no other Julia checksum library comes even close to its performance.) |
FWIW, ARM/AArch64 have both crc32 and crc32c. |
Also, the crc32(c) code will likely be the first complex candidate for testing/prototyping runtime cpu feature dispatch API. |
Ref: #21154. Even if we use this internally, it doesn't really belong in Base exports. I'd propose that we have a minimal
CRC32c
package in the standard library which exports this one function, leaving the definition inbase
(for internal usage).The text was updated successfully, but these errors were encountered: