Open
Conversation
Moelf
reviewed
Aug 29, 2025
Member
Author
Benchmark script
using BenchmarkTools
using Random
using TranscodingStreams
using CodecZstd
using ChunkCodecCore
const SUITE = BenchmarkGroup()
cbencht = SUITE["compression"] = BenchmarkGroup()
dbencht = SUITE["decompression"] = BenchmarkGroup()
cbenchd = SUITE["compression-decode"] = BenchmarkGroup()
dbenchd = SUITE["decompression-decode"] = BenchmarkGroup()
dbenchc = SUITE["decompression-size-hint"] = BenchmarkGroup()
ccodec = ZstdCompressor()
dcodec = ZstdDecompressor()
TranscodingStreams.initialize(ccodec)
TranscodingStreams.initialize(dcodec)
for N in [100, 100000, 1000000]
u1 = rand(Xoshiro(1234), UInt8, N)
c1 = transcode(ZstdCompressor, u1)
u2 = rand(Xoshiro(1234), 0x00:0x01, N)
c2 = transcode(ZstdCompressor, u2)
f = round.(randn(Xoshiro(1234), N); base=2, digits=7)
# byte shuffle
u3 = vec(permutedims(reinterpret(reshape, UInt8, f),(2,1)))
c3 = transcode(ZstdCompressor, u3)
for (data, compressed, name) in [
(u1, c1, "incompressible"),
(u2, c2, "compressible-bytes"),
(u3, c3, "byteshuffle"),
]
cbencht[name][N] = @benchmarkable transcode($ccodec, $data)
cbenchd[name][N] = @benchmarkable decode($ccodec, $data)
dbencht[name][N] = @benchmarkable transcode($dcodec, $compressed)
dbenchd[name][N] = @benchmarkable decode($dcodec, $compressed)
dbenchc[name][N] = @benchmarkable decode($dcodec, $compressed; size_hint=$(length(data)))
end
endCodecZstd Benchmark ResultsThis is with CodecZstd v0.8.6 and ChunkCodecCore v0.6.0 Compression Benchmarks
Decompression Benchmarks
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a way to allow
TranscodingStreams.Codecobjects to be used with thedecode,decode!,try_decode!, andtry_resize_decode!functions fromChunkCodecCorehttps://github.com/JuliaIO/ChunkCodecs.jl.Fixes #247 #132 #105
CC: @Moelf @eschnett @mkitti