-
Notifications
You must be signed in to change notification settings - Fork 291
Add support for ZStandard (de)compression #5907
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
Conversation
dcff362 to
26b1abe
Compare
|
Cool! I'd add a Nat parameter to the compression function. We can still offer a convenience function that calls it with a value of 3. @aryairani is there anything we should be aware of regarding: integrating this into builds or releases? |
Err, no — thanks for taking a look. I do like getting an external opinion whenever we add builtins as far as whether we want to make that commitment in the runtime vs leave it to pure Unison. As far as integrating it into builds or releases, the only caveat I can think of that it may not be on Share until we cut the next UCM release, as it's only at those times that we force a "sync" for new builtins. @regiskuckaertz If you could, go to https://github.com/regiskuckaertz/unison/actions/workflows/update-transcripts.yaml#rgh-run-workflow and run that workflow on your or alternatively if you're still at your dev desk, just run |
dolio
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look okay to me.
b05e1b0 to
408e5f4
Compare
|
@regiskuckaertz Here's the transcript error in builtins.md That's a lexer / parser error before getting to typechecking. You can use |
408e5f4 to
190c35e
Compare
|
ah, thank you I'll do that! yeah I fixed the length and also the integer literal, still don't have the muscle memory of typing |
|
After looking at the implementation of |
|
Hey @regiskuckaertz, I'm taking a look at it currently. My approach to debugging it was to just work on it interactively: Then ^ cryptic, but this installs all the builtins including your new one into Then in my So I guess btw I'm @aryairani on our discord if you wanna try to get me more interactively, but I'll try to keep an eye out here also. |
|
I'm not really sure what's happening here, but I do get and then |
|
I'm even more confused now, because this change didn't seem to have any effect: I'm still seeing the empty |
|
hi @aryairani many thanks for your help, I should have thought about going straight to Haskell 🤦 but also the way of loading the unison codebase with the base library is super valuable. Leave this with me, I must be able to fashion a payload that will produce an error. The weird thing is I tried with the CLI first, maybe I did introduce a skipped frame without knowing. |
|
(I can't work on this today, but tomorrow I'll keep on investigating) |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
@regiskuckaertz I went ahead and deleted the failure test, I'm not sure if it's worth the trouble to force having one. The round-trip tests work, so I'm willing to merge this as-is now. Let me know what you think. |
# Conflicts: # unison-src/transcripts/project-outputs/docs/adding-builtins.output.md
1205c19 to
34bc06a
Compare
|
Fixed. The Haskell implementation only produces an error when the size in the header is too large or there are leftovers after decompression. Skippable frames are supposed to start with |
|
@aryairani all done Sir, thanks heaps for your help on this! Do I need to add documentation somewhere? iiuc, it is generated from an already published version on the library. |
Overview
Add two new built-ins to the base library:
To offer basic support for compression using the ZStandard algorithm (http://facebook.github.io/zstd/).
Implementation notes
I added a new dependency to the unison-util-bytes project: https://hackage.haskell.org/package/zstd which is a thin wrapper over the C library.
Interesting/controversial decisions
To keep the same interface as
gzipCompress, I'm using the same default compression level as thezstdCLI, i.e. 3, which offers a good compromise between speed/size and memory/cpu consumption.Test coverage
I saw one tests for the other two compression functions which I blatantly added to, please let me know if there is anything else I missed.