-
Notifications
You must be signed in to change notification settings - Fork 14
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
slower than expected decompression #13
Comments
Thank you. I think this is mainly due to cross-compiling of BinaryBuilder.jl. We can see a similar slowdown in CodecZlib.jl, which I've confirmed it is caused by the binaries compiled with BinaryBuilder.jl. I believe Elliot is working hard on this problem, but if you need a faster version now, I think you need to compile your own Zstandard on your machine and edit the library loading path. |
Thanks for the response! I'm kind of dumb when it comes to binary dependencies in general; I built zstd v1.3.8 from source and replaced this line in the auto-generated
with
Now:
So performance has change a bit, but still not matching the python wrapper. Anything else I could try (or did I even follow your advice correctly)? |
Tried calling into
So BinaryBuilder issues aside, it seems we could simply improve the |
Thank you for investigation! You seem to be right; I'm going to investigate it further. Can you show me the package versions and the environment you are using? |
I've found an inefficiency in data processing due to silly buffering. I guess this causes the problem for the most part. I'll fix that soon. |
Glad to help :)
If it's helpful, the small functions I cooked up yesterday that I'm now using are something like: function transcode(::Type{ZstdCompressor}, compressed_bytes::Vector{UInt8}, level)
compressed_bound = ccall(:ZSTD_compressBound, Cint, (Cint,),
length(decompressed_bytes))
compressed_bytes = Vector{UInt8}(undef, compressed_bound)
acutal_length = ccall(:ZSTD_compress, Cint, (Ptr{UInt8}, Cint, Ptr{UInt8}, Cint, Cint),
compressed_bytes, length(compressed_bytes),
decompressed_bytes, length(decompressed_bytes),
level)
resize!(compressed_bytes, actual_length)
return compressed_bytes
end
function transcode(::Type{ZstdDecompressor}, compressed_bytes::Vector{UInt8})
decompressed_length = ccall(:ZSTD_getFrameContentSize, Clong,
(Ptr{UInt8}, Clong), compressed_bytes,
length(compressed_bytes))
decompressed_bytes = Vector{UInt8}(undef, decompressed_length)
ccall(:ZSTD_decompress, Cint, (Ptr{UInt8}, Cint, Ptr{UInt8}, Cint),
decompressed_bytes, length(decompressed_bytes),
compressed_bytes, length(compressed_bytes))
return decompressed_bytes
end |
Thank you! I'm pretty sure this is fixed by the latest master branches of TranscodingStreams.jl and CodecZstd.jl. If you still see the performance degradation, please feel free to reopen this issue. |
Hi, great packages, thanks for writing them! I'm trying to figure out the source of some overhead I'm seeing when decompressing via
transcode
vs. using thezstandard
Python wrapper.Using the
zstandard
Python wrapper:Using this package + TranscodingStreams:
If it helps,
recordings.ordered.json.zst
is ~16 MB and decompresses to ~620 MB.The text was updated successfully, but these errors were encountered: