Created
September 10, 2020 22:09
-
-
Save coolbutuseless/aa2a961f9c2a66549d18ca41938236f9 to your computer and use it in GitHub Desktop.
zstd quick bench
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
library(zstdlite) | |
set.seed(1) | |
bytes <- sample(as.raw(1:30), 1e6, replace = TRUE) | |
cz <- zstdlite::zstd_compress(bytes) | |
cb_gzip <- memCompress(bytes, type = 'gzip') | |
cb_bzip2 <- memCompress(bytes, type = 'bzip2') | |
cb_xz <- memCompress(bytes, type = 'xz') | |
length(cz) | |
length(cb_gzip) | |
length(cb_bzip2) | |
length(cb_xz) | |
uz <- zstdlite::zstd_decompress(cz) | |
ub <- memDecompress(cb, type = 'gzip') | |
bench::mark( | |
zstd_compress(bytes), | |
memCompress(bytes, type = 'gzip'), | |
memCompress(bytes, type = 'bzip2'), | |
memCompress(bytes, type = 'xz'), | |
check = FALSE | |
) | |
bench::mark( | |
zstd_decompress(cz), | |
memDecompress(cb_gzip , type = 'gzip'), | |
memDecompress(cb_bzip2, type = 'bzip2'), | |
memDecompress(cb_xz , type = 'xz'), | |
check = TRUE | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment