From 163dfa1c06484116ae543e1a21bb3397616035cb Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg Date: Wed, 28 Oct 2020 13:31:23 -0500 Subject: [PATCH] more benchmarks --- README.md | 11 ++++++++++- tests/benchmark.nim | 15 ++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index be38991..009e9a6 100644 --- a/README.md +++ b/README.md @@ -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 --- | ---: diff --git a/tests/benchmark.nim b/tests/benchmark.nim index 7c64f13..467e552 100644 --- a/tests/benchmark.nim +++ b/tests/benchmark.nim @@ -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}]"