more benchmarks

This commit is contained in:
Ryan Oldenburg 2020-10-28 13:31:23 -05:00
parent 162fa67d85
commit 163dfa1c06
2 changed files with 24 additions and 2 deletions

View File

@ -14,7 +14,7 @@ I have also verified that Zippy builds with `--experimental:strictFuncs` on Nim
### Performance
Benchmarks can be run comparing different Zip implementations. My benchmarking shows this library performs well but it is not as fast as zlib itself (not a surprise). Check the performance yourself by running [tests/benchmark.nim](https://github.com/guzba/zippy/blob/master/tests/benchmark.nim).
Benchmarks can be run comparing different Zip implementations. My benchmarking shows this library performs very well but it is not as fast as zlib itself (not a surprise). Check the performance yourself by running [tests/benchmark.nim](https://github.com/guzba/zippy/blob/master/tests/benchmark.nim).
`nim c --gc:arc -d:release -r .\tests\benchmark.nim` (1000 uncompresses, lower time is better)
@ -36,6 +36,15 @@ alice29.txt.z | 3.3442s
urls.10K.z | 16.1209s
fixed.z | 19.8003s
https://github.com/nim-lang/nimPNG results:
File | Time
--- | ---:
randtest3.z | 0.1648s
rfctest3.z | 0.5760s
alice29.txt.z | 2.2471s
urls.10K.z | 11.0067s
fixed.z | 10.0772s
https://github.com/nim-lang/zip results:
File | Time
--- | ---:

View File

@ -1,4 +1,4 @@
import miniz, std/monotimes, strformat, zip/zlib, zippy
import miniz, std/monotimes, strformat, zip/zlib, zippy, nimPNG/nimz
const
files = [
@ -48,3 +48,16 @@ block nimlang_zip: # Requires zlib1.dll
inc(c, uncompressed.len)
let delta = float64(getMonoTime().ticks - start) / 1000000000.0
echo &" {file}: {delta:.4f}s [{c}]"
block jangko_nimPNG:
echo "https://github.com/jangko/nimPNG"
for file in files:
let
compressed = readFile(&"tests/data/{file}")
start = getMonoTime().ticks
var c: int
for i in 0 ..< iterations:
let uncompressed = zlib_decompress(nzInflateInit(compressed))
inc(c, uncompressed.len)
let delta = float64(getMonoTime().ticks - start) / 1000000000.0
echo &" {file}: {delta:.4f}s [{c}]"