2020-10-28 06:12:37 +00:00
|
|
|
import miniz, std/monotimes, strformat, zip/zlib, zippy
|
2020-10-17 07:10:13 +00:00
|
|
|
|
2020-10-28 05:29:07 +00:00
|
|
|
const
|
|
|
|
files = [
|
|
|
|
"randtest3.z",
|
|
|
|
"rfctest3.z",
|
|
|
|
"alice29.txt.z",
|
|
|
|
"urls.10K.z",
|
|
|
|
"fixed.z"
|
|
|
|
]
|
|
|
|
iterations = 1000
|
2020-10-14 04:09:43 +00:00
|
|
|
|
2020-10-28 05:29:07 +00:00
|
|
|
block guzba_zippy:
|
|
|
|
echo "https://github.com/guzba/zippy"
|
|
|
|
for file in files:
|
|
|
|
let
|
|
|
|
compressed = readFile(&"tests/data/{file}")
|
|
|
|
start = getMonoTime().ticks
|
|
|
|
var c: int
|
|
|
|
for i in 0 ..< iterations:
|
|
|
|
let uncompressed = zippy.uncompress(compressed)
|
|
|
|
inc(c, uncompressed.len)
|
|
|
|
let delta = float64(getMonoTime().ticks - start) / 1000000000.0
|
|
|
|
echo &" {file}: {delta:.4f}s [{c}]"
|
|
|
|
|
|
|
|
block treeform_miniz:
|
|
|
|
echo "https://github.com/treeform/miniz"
|
|
|
|
for file in files:
|
|
|
|
let
|
|
|
|
compressed = readFile(&"tests/data/{file}")
|
|
|
|
start = getMonoTime().ticks
|
|
|
|
var c: int
|
|
|
|
for i in 0 ..< iterations:
|
|
|
|
let uncompressed = miniz.uncompress(compressed)
|
|
|
|
inc(c, uncompressed.len)
|
|
|
|
let delta = float64(getMonoTime().ticks - start) / 1000000000.0
|
|
|
|
echo &" {file}: {delta:.4f}s [{c}]"
|
2020-10-28 06:10:36 +00:00
|
|
|
|
|
|
|
block nimlang_zip: # Requires zlib1.dll
|
|
|
|
echo "https://github.com/nim-lang/zip"
|
|
|
|
for file in files:
|
2020-10-28 06:12:37 +00:00
|
|
|
let
|
|
|
|
compressed = readFile(&"tests/data/{file}")
|
|
|
|
start = getMonoTime().ticks
|
|
|
|
var c: int
|
|
|
|
for i in 0 ..< iterations:
|
|
|
|
let uncompressed = zlib.uncompress(compressed, stream = ZLIB_STREAM)
|
|
|
|
inc(c, uncompressed.len)
|
|
|
|
let delta = float64(getMonoTime().ticks - start) / 1000000000.0
|
|
|
|
echo &" {file}: {delta:.4f}s [{c}]"
|