-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
How do I get --patch-from to work when using zstd as a library? #2835
Comments
The core library API equivalent to |
@Cyan4973 I use a zstd Rust Wrapper (https://github.com/gyscos/zstd-rs) that uses Also, compressing a small file with |
As mentioned, If what you are asking for is a dedicated API to replicate what is achieved with command |
@Cyan4973 My guess is the same. So I found out by reading the code that the zstd is great for delta updates, and I want my application to benefit from its extremely fast decompression speed and small delta package size. |
The 2 main things I remember is to set the |
@Cyan4973 For a 123,983kb file, I use The size (55M) is the same as if it had been compressed directly without the dictionary, which I suspect is probably because the dictionary didn't take effect at all. And |
Sticky parameters are compatible with In contrast, Try with |
@Cyan4973 Now it works properly! Thank you for your help! |
In my case, the dictionary didn't seem to have any effect when using |
This is weird. Do you have a reproduction case for this issue with |
I'm sorry, I didn't think it was worth looking into, since I don't think there is an issue with zstd, just with how I'm using it without really knowing how the internals work. |
Yeah, it's probably better to forward this issue to |
In the end, I removed my dependency to the library, and I'm just calling the dll functions via C# interop. I still have the issue though, so maybe there really is something to it?
it works, but if I call I attached my project files in zsharptd.zip (it's in C# though, and you have to change the hardcoded paths and run with --patch in order to try it out) |
What's the size of the dictionary content ? |
I think it was something like 700MB. The patch is 160MB with refPrefix and 700MB with loadDictionary. Edit: I can check the actual size if necessary (to calculate windowLog maybe) |
OK, so I think we have a reason here. To begin with, I'm even surprised it accepted to load such a dictionary, this is way beyond its default memory usage limits. So maybe there's something to look at here. Second, the LDM mode is not compatible with Now, there are still differences between "it's less effective", "it's barely effective", "it's not effective at all". But then, even if the dictionary is loaded, by increasing memory limit typically, it's likely going to be less effective than |
@Cyan4973 we don't have a dictionary size limit on either the compressor or decompressor side. But yeah, LDM doesn't work with |
So I tried with a 31913kB dictionary, (the target file being 34335kB - I just downloaded a zip of wordpress 6.0 and 6.1.1 source code from their github) using I'm not sure ldm alone being disabled explains everything, I remember disabling it from the 700MB file I used first, and the delta was about 400MB, so obviously ldm is really useful for this usecase. I'm not sure there is even a problem here, I just wanted to mention for people who followed this issue as kind of a tutorial on how to use --patch-from like functionality with the library rather than the executable that If you think this is worth investigating I have no trouble providing any information you want, but I wouldn't want you spending time on this because you think I'm stuck or anything. |
Good point @reyqn , we understand that At this point, we are trying to understand if there is an API antipattern with So, my only remaining question would be : This result would be helpful to guide an investigation. |
It's roughly the same. File hashes are different. One is 31,506,058 bytes, the other is 31,506,225 bytes. The file hashes are reproducible (each time I run the C# program calling the library with |
OK, so it's roughly inefficient. That seems a little too inefficient, given the results with Thanks for the feedback @reyqn . |
I found out that the implementation of the
--patch-from
is placed in the "programs" folder and it is not distributed with the static or dynamic libraries. This means that if I don't use the cli program, I wouldn't be able to use the--patch-from
function directly.But I don't know much about how zstd works, how should I configure the compress or decompress parameters to make the
--patch-from
works in my own program?The text was updated successfully, but these errors were encountered: